sandwich

A funny programming language written in Rust
git clone https://tilde.team/~karx/sandwich.git
Log | Files | Refs | README | LICENSE

commit 6788ddbbb62e1d01ce67d1a7121d0e34ff467a7a
parent 618a47422ec4da3da9bc25b712100f8983c174ba
Author: ~karx <karx@tilde.team>
Date:   Wed, 10 Feb 2021 20:17:16 +0000

Add section to README about functions

Diffstat:
MREADME.md | 33++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -30,6 +30,7 @@ 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 [Functions](#make-a-pull-request) for more info - `#` - comment: the interpreter will skip this line. Here's an example "Hello world" program: @@ -40,6 +41,31 @@ lwWorld! p$h $w ``` +### Functions + +*functions* are ways to "pipe" math output to another operation. For example, you could assign the output to a variable, like below: + +``` +#Declare a function +fxa3-3 +#Call the function and assign it to variable +lv*x +#will print out 6 +p$v +``` + +Or you could print it out directly: + +``` +#Declare a function +fxs30-3 +#Call it and print it out +#Will print out 27 +p*x +``` + +Read [the devlog entry for more](https:/tilde.team/~karx/blog/sandwich-devlog-3-function-junction.html) info. + ## Contributing @@ -63,10 +89,11 @@ Read [this guide](https://git-send-email.io) for more information. ## TODO -- [x] Better documentation + - [ ] Ability to explicitly print math output and assign math output to variables -- [x] Add support for comments (should be pretty easy) -- [x] Unit testing and CI/CD +- [ ] Better function parsing (multi-instruction functions?) +- [ ] Importing/Running other files +- [ ] "Verbose" or "Debug" mode (environment variable or flag?) ## License