3 releases
0.0.4 | Aug 25, 2020 |
---|---|
0.0.3 | Aug 24, 2020 |
0.0.1 | Aug 16, 2020 |
#1522 in Development tools
81KB
2K
SLoC
Pico-Lang
A minimal and safe programming language expressed in JSON
Install
cargo install pico-lang
build
cargo build
or just run it
cargo run
enable nats (incomplete)
cargo run --features srv_nats
PicoRules
JSON
formmated file that encapsulates your logic
see simple.json example rule file
start server with
cargo run -- --rules simple.json
submit rule execution
curl -X POST localhost:8000/submit -d '{"nochicken": 1}' -H 'Content-Type: application/json'
returns:
{"namespaced":{},"input":{"nochicken":1},"locals":{"enochicken":"must be no hens"}}
and with a chicken:
curl -X POST localhost:8000/submit -d '{"chicken": 1}' -H 'Content-Type: application/json'
returns:
{"locals":{"egg":"must have been layed"},"namespaced":{},"input":{"chicken":1}}
warp submit
curl -v -X POST localhost:8000/submit -d '{"xp": "x1xxx", "y": "y2"}' -H 'Content-Type: application/json'
curl -v -X POST localhost:8000/submit -d '{"xp": "x1xxx", "y": "y2", "json": {"ja": "rules}}' -H 'Content-Type: application/json'
benchmark
wrk -t 5 -c 40 -s bench/sub.lua http://localhost:8000/submit
Dependencies
~30–44MB
~800K SLoC