README (1745B)
1 sandwich 2 ========= 3 4 sandwich is a funny programming language written in Rust. 5 6 "Why's it called sandwich?" 7 8 "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!" 9 10 Running 11 ------- 12 13 Use cargo to run an input file. 14 15 16 $ git clone https://tildegit.org/karx/sandwich 17 $ cd sandwich 18 $ cargo run <filename> 19 20 Reference 21 --------- 22 23 sandwich is comprised of opcodes. The syntax looks like this: 24 25 26 <opcode><Arguments> 27 28 29 The currently available opcodes are as follows: 30 31 - p - print out the arguments: `pHello World!` prints "Hello World!" 32 - a, s, m, d - add, subtract, multiply, and divide, respectively: `a2-2` adds 2 + 2. 33 - l - declare a variable: `lv9` declares variable `v` with value `9`; doing `p$v` prints out 9. 34 - f - declare a function: see the devlog entry[0] for more info 35 - i - import variables and functions from another file: see the devlog entry[1] for more info. 36 37 [0]: https:/tilde.team/~karx/blog/sandwich-devlog-3-function-junction.html 38 [1]: https://tilde.team/~karx/blog/from-cup-import-coffee-sandwich-devlog-4.html 39 40 41 Here's an example "Hello world" program: 42 43 44 lhHello 45 lwWorld! 46 p$h $w 47 48 49 Contributing 50 ------------ 51 52 Please make sure to update tests as appropriate. 53 54 You can send a patch to `karx@tilde.team`. 55 Read [this guide](https://git-send-email.io) for more information. 56 57 For major changes, include the reason for the change in the email. 58 59 60 TODO 61 ----- 62 63 64 - [x] Ability to explicitly print math output and assign math output to variables 65 - [ ] Better function parsing (multi-instruction functions?) 66 - [x] Importing/Running other files 67 - [ ] "Verbose" or "Debug" mode (environment variable or flag?)