mirror of
https://tildegit.org/karx/sandwich.git
synced 2024-05-19 05:25:48 -05:00
Update 'README.md'
This commit is contained in:
parent
dcef0a3943
commit
b64a724935
38
README.md
38
README.md
|
@ -8,39 +8,23 @@
|
||||||
|
|
||||||
*"Well, Rust's logo is a crab, right? And crabs live on beaches. Beaches have sand. A program is just a bunch of bytes one after another. So what do you bite that's related to sand? A sandwich!"*
|
*"Well, Rust's logo is a crab, right? And crabs live on beaches. Beaches have sand. A program is just a bunch of bytes one after another. So what do you bite that's related to sand? A sandwich!"*
|
||||||
|
|
||||||
## Running
|
## Example
|
||||||
|
|
||||||
Use `cargo` to run an input file.
|
```sandwich
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://tildegit.org/karx/sandwich
|
|
||||||
cd sandwich
|
|
||||||
cargo run <filename>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
`sandwich` is comprised of *opcodes*. The syntax looks like this:
|
|
||||||
```
|
|
||||||
opcodeArguments
|
|
||||||
```
|
|
||||||
|
|
||||||
The currently available opcodes are as follows:
|
|
||||||
|
|
||||||
- `p` - print out the arguments: `pHello World!` prints "Hello World!"
|
|
||||||
- `a`, `s`, `m`, `d` - add, subtract, multiply, and divide, respectively: `a2-2` adds 2 + 2.
|
|
||||||
- `l` - declare a variable: `lv9` declares variable `v` with value `9`; doing `p$v` prints out 9.
|
|
||||||
- `f` - declare a function: see [the devlog entry](https:/tilde.team/~karx/blog/sandwich-devlog-3-function-junction.html) for more info
|
|
||||||
- `i` - import variables and functions from another file: see [the devlog entry](https://tilde.team/~karx/blog/from-cup-import-coffee-sandwich-devlog-4.html) for more info.
|
|
||||||
|
|
||||||
Here's an example "Hello world" program:
|
|
||||||
|
|
||||||
```
|
|
||||||
lhHello
|
lhHello
|
||||||
lwWorld!
|
lwWorld!
|
||||||
|
# prints hello world
|
||||||
p$h $w
|
p$h $w
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
See the [Running/Installation](/karx/sandwich/wiki/Running) instructions for more info.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Documentation is hosted on [the wiki](/karx/sandwich/wiki/Reference).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue