update README, add plus11.gmh.source

This commit is contained in:
2020-05-10 10:54:00 +08:00
parent 68784da463
commit b527f30870
2 changed files with 48 additions and 6 deletions

View File

@@ -1,8 +1,15 @@
# grassmudhorse.rs
Grass Mud Horse in Rust 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 ```shell
$ cargo b $ cargo b
@@ -11,15 +18,17 @@ OR
$ cargo b --release $ cargo b --release
``` ```
# Usage
help: help:
```shell ```shell
$ ./target/debug/grassmudhorse -h $ grassmudhorse -h
grassmudhorse.rs v0.1 grassmudhorse.rs v0.1
``` ```
execute from file: execute from file:
```shell ```shell
$ ./target/debug/grassmudhorse print-110.gmh $ grassmudhorse print-110.gmh
1 1
2 2
3 3
@@ -34,7 +43,7 @@ $ ./target/debug/grassmudhorse print-110.gmh
execute from stdin: execute from stdin:
```shell ```shell
$ cat print-110.gmh | ./target/debug/grassmudhorse $ cat print-110.gmh | grassmudhorse
1 1
2 2
3 3
@@ -47,8 +56,34 @@ $ cat print-110.gmh | ./target/debug/grassmudhorse
10 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: compile and execute:
```shell ```shell
$ ./target/debug/grassmudhorse --compile plus1100.gmh.source | ./target/debug/grassmudhorse $ grassmudhorse --compile plus1100.gmh.source | grassmudhorse
5050 5050
``` ```

7
plus11.gmh.source Normal file
View File

@@ -0,0 +1,7 @@
push 1
push 2
add
stdoutnum
push 10
stdoutchar
end