https://github.com/comcast/littlesheens
A Sheens implementation that has a small footprint
https://github.com/comcast/littlesheens
Last synced: about 1 year ago
JSON representation
A Sheens implementation that has a small footprint
- Host: GitHub
- URL: https://github.com/comcast/littlesheens
- Owner: Comcast
- License: apache-2.0
- Created: 2018-01-08T20:45:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-14T15:33:17.000Z (almost 5 years ago)
- Last Synced: 2025-04-11T21:07:28.176Z (about 1 year ago)
- Language: C
- Homepage:
- Size: 131 KB
- Stars: 16
- Watchers: 9
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# A minimalist C library for working with Sheens
## Summary
A minimalist [Sheens](https://github.com/Comcast/sheens)
implementation in ECMAScript that's executed by
[Duktape](http://duktape.org/) and wrapped in a C library. Yes, that
does sound a little odd.
The stripped 32-bit demo executable is 360KB. The core ECMAScript
code (un-minified) is less than 40KB (11KB minified). An experimental
[nodejs](https://nodejs.org/en/) module is available (via `make
nodejs`).
See that [Sheens repo](https://github.com/Comcast/sheens) for more
documentation about these machines.
## License
This repo is licensed under [Apache License 2.0](LICENSE).
## API
See `machines.h`.
## A demo
For now, running the demo requires two tools written in
[Go](https://golang.org/), so you need Go installed to build this
demo. (We'll remove this unncessary dependency soon.)
```Shell
go get github.com/bronze1man/yaml2json
go get github.com/tdewolff/minify/cmd/minify
make demo
./demo
```
## Another demo
This demo is a simple process that reads messages from `stdin` and
writes output to `stdout`.
```Shell
make specs/turnstile.js specs/double.js sheensio
# Define a "crew" of two machines.
cat< crew.json
{"id":"simpsons",
"machines":{
"doubler":{"spec":"specs/double.js","node":"listen","bs":{"count":0}},
"turnstile":{"spec":"specs/turnstile.js","node":"locked","bs":{}}}}
EOF
# Send messages to that crew.
cat<