the ~karx journals

various musings of ~karx

Sandwich devlog #2

February 08, 2021 — ~karx

Today (well, actually, yesterday. I just forgot to write this until just now), i did three things in the sandwich development process.

newline separator

the first thing i did was make the separator a \n instead of a space. because of this change, you can now print strings with spaces in them. for example, to print “Hello, world!” in the previous version, you had to do this:

pHello pWorld!

but they would actually print on separate lines. this is not what i wanted, so i changed it to look like this:

pHello world!

subsequent instructions would go on their own lines, rather than being next to other instructions.

explicit variable calls and comments

before, variables would get automatically get converted. however, this can be very annoying. this is what it looked like:

lhHello ph

but what if you wanted to print h? you’d have to set the variable h to be h, then print it out, then set it back to what it was before. to combat this, i’ve changed this to look like the following:

lhHello
p$h

variables are now denoted by a $ before its name.

i also added comments, which can be used like so:

pHello, world!
# the interpreter will skip the next line (and this line)
#pThis will not print

readme, license, code comments

i added a readme and a (un)license, so newcomers will know how to use the language. i also added comments to the code, so people readding the source code can tell what each peice of code does.

as always, please try to contribute to sandwich by sending a patch to my email or making a pull request on tildegit. instructions are in the README.

happy coding!

tags: sandwich, rust, programming, devlog