https://github.com/drsensor/scdlang
(status: soon revived as different project) Statechart Description Language (just an experiment, need to be rewritten)
https://github.com/drsensor/scdlang
description-language my-experiment statecharts statemachine
Last synced: about 1 year ago
JSON representation
(status: soon revived as different project) Statechart Description Language (just an experiment, need to be rewritten)
- Host: GitHub
- URL: https://github.com/drsensor/scdlang
- Owner: DrSensor
- License: upl-1.0
- Created: 2019-01-31T07:58:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-05T11:53:12.000Z (almost 5 years ago)
- Last Synced: 2025-05-05T01:33:05.621Z (about 1 year ago)
- Topics: description-language, my-experiment, statecharts, statemachine
- Language: Rust
- Homepage:
- Size: 588 KB
- Stars: 101
- Watchers: 4
- Forks: 2
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Scdlang
**S**tate**c**harts **D**escription **Lang**uage
[](https://github.com/drsensor/scdlang/releases/latest)
[](https://hub.docker.com/r/scdlang/scrap)
[](./LICENSE)
> 🚧Status: **🗶perimental *4*ever**🤞
## About
Scdlang (pronounced `/ˈesˌsi:ˈdi:ˈlæŋ/`) is a description language for describing Statecharts that later can be used to generate code or just transpile it into another format. This project is more focus on how to describe Statecharts universally that can be used in another language/platform rather than drawing a Statecharts diagram. For drawing, see [State Machine Cat][].

### Philosophy
- **Readable** just like you read then visualize a state diagram
- **Writeable** just like you write code which is concise, clear, and can be refactored
- **Transferable** to any implementation (e.g platform, programming language, runtime, etc)
### Features and *Wishlist*
- [x] CLI utils (see [usage](packages/cli/README.md))
- [x] Syntax is inspired from various drawing languages like [mermaid][], [Graphviz][], [PlantUML][], and many more
- [x] Decent error message
- [x] Avoid invalid and ambigous transition via semantics analysis
- [ ] Rule definition for static analysis and formal verification
- Transpile into other formats:
- [x] [XState](https://xstate.js.org/docs/)
- [x] [State Machine Cat][]
- [ ] [Kingly](https://brucou.github.io/documentation/)
- [ ] [CSV](https://github.com/DrSensor/scdlang/issues/24)
- [ ] [Sismic](https://sismic.readthedocs.io/en/latest/)
- [ ] [SCXML](https://www.w3.org/TR/scxml/)
- [ ] [WaveDrom](https://observablehq.com/@drom/wavedrom)
- Compile into other formats (need this to make it being an embeddable DSL):
- [ ] WebAssembly (using [parity-wasm](https://github.com/paritytech/parity-wasm))
- [ ] LLVM IR 🤔 (open the possibility to be compiled as wasm, dynlib, and static lib)
- Code generation 🤔 (not sure if I need this but why not?)
- [ ] Julia via [`@generated`](https://docs.julialang.org/en/v1/manual/metaprogramming/#Generated-functions-1) implemented as [parametric](https://docs.julialang.org/en/v1/manual/methods/#Parametric-Methods-1) [multiple-dispatch](https://en.wikipedia.org/wiki/Multiple_dispatch#Julia) [functors](https://docs.julialang.org/en/v1/manual/methods/#Function-like-objects-1)
- [ ] Rust via [`#[proc_macro_attribute]`](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros) implemented as [typestate programming](https://rust-embedded.github.io/book/static-guarantees/typestate-programming.html)? (I'm still afraid if it will conflict with another crates)
- [ ] Elixir via [`use`](https://elixir-lang.org/getting-started/alias-require-and-import.html#use) macro which desugar into [gen_statem](https://andrealeopardi.com/posts/connection-managers-with-gen_statem/) 💪
- [ ] Flutter via [`builder_factories`](https://github.com/flutter/flutter/wiki/Code-generation-in-Flutter) (waiting for the [FFI](https://github.com/dart-lang/sdk/issues/34452) to be stable)
> For more info, see the changelog in the [release page][]
## Getting Started
Currently, this project only have the binary CLI for each OS. Please go to the [release page][] to download then extract it. It also shipped with auto-completions script for your preffered shell.
### Installing
Just download the binary in the [release page][] or follow this instructions 👇
#### Linux🐧
TODO: (AUR, DEB, RPM) or via shellscript just like installing rustup
#### MacOS🍏
TODO: brew or via shellscript just like installing rustup
#### Windows🗔
TODO: chocolatey or via msi installer just like installing rustup
#### using [Docker](https://hub.docker.com/r/scdlang/scrap)🐳
> [smcat][State Machine Cat], [dot][Graphviz], and [graph-easy][] are pre-installed in this docker image
```console
docker pull scdlang/scrap
```
#### via [Cargo](https://doc.rust-lang.org/cargo)📦
```console
cargo install s-crap
```
## Contributing
[](https://github.com/DrSensor/scdlang/labels/help%20wanted)
[](https://github.com/DrSensor/scdlang/labels/good%20first%20issue)
Any contributions are welcome as long as it follow [Code of Conduct](CODE_OF_CONDUCT.md).
If anyone have questions or something to discuss, feel free to DM or mention me in any platform that have my profile picture 👹.
## License
This project is licensed under the Universal Permissive License 1.0 - see the [LICENSE](LICENSE) file for more detail.
## Resources
- [*Statecharts in the Making: A Personal Account*](http://www.wisdom.weizmann.ac.il/~harel/papers/Statecharts.History.pdf) by David Harel
- [Welcome to the world of Statecharts](https://statecharts.github.io/)
[Graphviz]: https://www.graphviz.org/
[PlantUML]: http://plantuml.com/state-diagram
[mermaid]: https://mermaidjs.github.io/
[State Machine Cat]: https://github.com/sverweij/state-machine-cat
[graph-easy]: https://metacpan.org/pod/distribution/Graph-Easy/bin/graph-easy
[release page]: https://github.com/DrSensor/scdlang/releases