Downloads per day
Last 90 days · 8 total · peak 7
Dossier
What harel does.
Reads W3C SCXML statecharts into typed Rust structures, checks they are well formed, and writes them back out.
From the crate: “Harel Statecharts Parser.”
- Codename
- The Diagrammer
- Role
- Statechart parser
- Character
- Sees nested states everywhere and can't help drawing them. Insists that every transition has a target.
- Domain
- Concurrency & state
- Enlisted
- 8 October 2026
- Last release
- v0.1.0, 8 October 2026
- Keywords
fsm,harel,scxml,statecharts
Use cases
Put it to work.
- Lint
.scxmlfiles in CI. - Feed statecharts into a model checker or code generator.
- Round-trip statecharts between tools.
Getting started
Call it in.
Add it to a Rust project, then follow the example. The full API is on docs.rs.
Install
cargo add harel
Example
use harel::*;
// Parse a simple statechart
let statechart_text = r#"
statechart TrafficLight {
state Red {
on timer -> Green
}
state Green {
on timer -> Yellow
}
state Yellow {
on timer -> Red
}
}
"#;
// Parse the statechart
let parser = HarelParser::new();
let statechart = parser.parse(statechart_text)?;
// Analyze the parsed statechart
println!("Statechart name: {}", statechart.name());
println!("Number of states: {}", statechart.states().len());Build with a prompt
Add the Rust crate `harel` (version 0.1.0) to this project with `cargo add harel`. I want to use it for this: Reads W3C SCXML statecharts into typed Rust structures, checks they are well formed, and writes them back out. Before writing code, read its README at https://crates.io/crates/harel and the API docs at https://docs.rs/harel. Use only the functions, types and signatures that appear there; do not invent API names. Write a minimal working example and one test that runs it.
Paste this into Claude Code or another coding agent.
Specs
- Version
- 0.1.0
- License
- MIT
- Edition
- Rust 2024
- Size
- 908 lines of code, 54 of comments
- Package
- 22.0 KB compressed
- Dependencies
- roxmltree, thiserror
- Used by
- 0 crates on crates.io
- Docs
- docs.rs, built
- Repository
- cryptopatrick/harel · 0★ · 0 forks · 0 open issues · pushed 15 Oct 2025
Release history
| Version | Date | Downloads |
|---|---|---|
| 0.1.0 | 8 Oct 2026 | 8 |
Documentation
The manual.
The crate's README as published on crates.io. The full API reference is on docs.rs.
Read the README
HAREL
Rust implementation of Harel Statecharts parser.
What is Harel • Features • How To Use • Documentation • License
📌 Table of Contents
Table of Contents
🤔 What is Harel
harel is a Rust library that provides a parser for Harel Statecharts, a powerful extension of finite state machines that supports hierarchical (nested) states, concurrent states, and complex state transitions. Harel Statecharts were introduced by David Harel in 1987 as a visual formalism for describing the behavior of complex reactive systems.
Use Cases
- Embedded Systems: Model complex device behaviors and state machines
- Game Development: Implement AI behaviors and game state management
- Protocol Implementation: Design and validate communication protocols
- Workflow Systems: Model business processes and workflow logic
- Reactive Systems: Handle event-driven system behaviors
Architecture
The library provides:
- Parser: Converts textual statechart descriptions into structured data
- AST Representation: Abstract syntax tree for statechart elements
- Validation: Ensures statechart correctness and well-formedness
- Traversal: Navigate and analyze statechart structures
📷 Features
Core Parsing
- Hierarchical States: Support for nested state structures
- Concurrent States: Parallel state execution modeling
- Transitions: State-to-state transitions with guards and actions
- Events: Event-driven state machine behavior
Statechart Elements
- States: Simple states, composite states, and concurrent regions
- Transitions: Internal and external transitions with conditions
- Guards: Boolean conditions for transition enablement
- Actions: Entry, exit, and transition actions
Validation & Analysis
- Syntax Validation: Ensures proper statechart syntax
- Semantic Checks: Validates statechart semantics and consistency
- Structure Analysis: Analyzes state hierarchy and relationships
🚙 How to Use
Installation
Add to your Cargo.toml:
[dependencies]
harel = "0.1"
Or install with cargo:
cargo add harel
Example
use harel::*;
// Parse a simple statechart
let statechart_text = r#"
statechart TrafficLight {
state Red {
on timer -> Green
}
state Green {
on timer -> Yellow
}
state Yellow {
on timer -> Red
}
}
"#;
// Parse the statechart
let parser = HarelParser::new();
let statechart = parser.parse(statechart_text)?;
// Analyze the parsed statechart
println!("Statechart name: {}", statechart.name());
println!("Number of states: {}", statechart.states().len());
📚 Documentation
Comprehensive documentation is available at docs.rs/harel, including:
- API reference for all public types and functions
- Tutorial on parsing statecharts
- Examples of different statechart patterns
- Best practices for statechart design
🖊 Author
Keybase Verification:
https://keybase.io/cryptopatrick/sigs/8epNh5h2FtIX1UNNmf8YQ-k33M8J-Md4LnAN
🐣 Support
Leave a ⭐ if you think this project is cool.
🗄 License
This project is licensed under MIT. See LICENSE for details.
Resources
Same unit
Other agents.
-
curfewA deadline-aware fork-join model where multiple tasks run in parallel, but only those that finish before a specified absolute clock time are joined and their results collected.
-
graph_mvccRust library for working with Multi-Version Concurrency Control in Graph Databases.
-
squadleader-scenario
Scenario builder tools for the SquadLeader system.
-
hugin
A visual cpu profiler.