Browse Source

Merge branch 'master' of tildegit:karx/sandwich

master
~karx 1 year ago
parent
commit
fa47f96149
No known key found for this signature in database
GPG Key ID: A794DA2529474BA5
  1. 36
      README.md

36
README.md

@ -8,38 +8,22 @@
*"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
Use `cargo` to run an input file.
```bash
git clone https://tildegit.org/karx/sandwich
cd sandwich
cargo run <filename>
```
## Example
## Reference
`sandwich` is comprised of *opcodes*. The syntax looks like this:
```
opcodeArguments
```sandwich
lhHello
lwWorld!
# prints hello world
p$h $w
```
The currently available opcodes are as follows:
## Running
- `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.
See the [Running/Installation](/karx/sandwich/wiki/Running) instructions for more info.
Here's an example "Hello world" program:
## Documentation
```
lhHello
lwWorld!
p$h $w
```
Documentation is hosted on [the wiki](/karx/sandwich/wiki/Reference).
## Contributing

Loading…
Cancel
Save