diff --git a/README.md b/README.md index a6dfdc7..d765e1c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ -# grassmudhorse.rs Grass Mud Horse in Rust -compile: +# Intrduction + +Grass Mud Horse Language Spec - [https://playsecurity.org/rawfile/grass_mud_horse_language_specification.md](https://playsecurity.org/rawfile/grass_mud_horse_language_specification.md) + +![](https://grassmudhorse.org/resources/gmh-lang.jpg) + +# Compile + +compile grassmudhorse.rs: ```shell $ cargo b @@ -11,15 +18,17 @@ OR $ cargo b --release ``` +# Usage + help: ```shell -$ ./target/debug/grassmudhorse -h +$ grassmudhorse -h grassmudhorse.rs v0.1 ``` execute from file: ```shell -$ ./target/debug/grassmudhorse print-110.gmh +$ grassmudhorse print-110.gmh 1 2 3 @@ -34,7 +43,7 @@ $ ./target/debug/grassmudhorse print-110.gmh execute from stdin: ```shell -$ cat print-110.gmh | ./target/debug/grassmudhorse +$ cat print-110.gmh | grassmudhorse 1 2 3 @@ -47,8 +56,34 @@ $ cat print-110.gmh | ./target/debug/grassmudhorse 10 ``` +compile: +```shell +$ cat plus11.gmh.source +push 1 +push 2 +add +stdoutnum +push 10 +stdoutchar +end + + +$ grassmudhorse --compile plus11.gmh.source +草草草泥马 +草草草泥草马 +泥草草草 +泥马草泥 +草草草泥草泥草马 +泥马草草 +马马马 + + +$ grassmudhorse --compile plus11.gmh.source | grassmudhorse +3 +``` + compile and execute: ```shell -$ ./target/debug/grassmudhorse --compile plus1100.gmh.source | ./target/debug/grassmudhorse +$ grassmudhorse --compile plus1100.gmh.source | grassmudhorse 5050 ``` diff --git a/plus11.gmh.source b/plus11.gmh.source new file mode 100644 index 0000000..0dac31f --- /dev/null +++ b/plus11.gmh.source @@ -0,0 +1,7 @@ +push 1 +push 2 +add +stdoutnum +push 10 +stdoutchar +end