Merge branch 'master' of tildegit:karx/sandwich
continuous-integration/drone/push Build is passing Details

This commit is contained in:
~karx 2021-04-08 14:09:51 -05:00
commit fa47f96149
No known key found for this signature in database
GPG Key ID: A794DA2529474BA5
1 changed files with 11 additions and 27 deletions

View File

@ -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!"*
## Running
## Example
Use `cargo` to run an input file.
```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:
```
```sandwich
lhHello
lwWorld!
# prints hello world
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