(it's shit)
This repository holds the source code and test files for the SHIT snake language, a final project for CS4410 at Northeastern University. Written by Jamin Eisenberg and Daniel Susman.
- Strings and Comments
- See Our String Library for details
- Tuples (untyped)
- First-class, recursive lambdas
- I/O (
input(),print(val)) - Cheney's semi-space garbage collection
- x84_64 target architecture
- Register Allocation via Graph Coloring
- Sequencing
- Nil values
def isPrefix(str, prefix):
if len(prefix) > len(str): false
else: if len(prefix) == 0: true
else: equal(str[0], prefix[0]) && isPrefix(str[1:], prefix[1:])
def splitHelp(str, delim, acc):
if len(str) == 0: (acc, )
else:
let fs = str[0], rst = str[1:] in
if isPrefix(delim, fs):
(acc,) ^ splitHelp(str[len(delim):], delim, "")
else: splitHelp(rst, delim, acc ^ fs)
def split(str, delim):
if len(str) == 0: (str,)
else: splitHelp(str, delim, "")
def pigLatinHelp(s):
if len(s) == 0: ""
else: s[0][1:] ^ s[0][0] ^ "ay " ^ pigLatinHelp(s[1:])
def pigLatin(s):
if len(s) == 0: s
else:
let words = split(s, " ") in
pigLatinHelp(words)
pigLatin("pig latin is the best way to communicate");
To build our project and run unit/integration tests,
$ make test && ./testTo run a specific test file,
$ make test
$ ./output/do_pass/<file_name>.runTo view intermediate representations and state of the world through the various compilation phases,
$ ./main -t input/do_pass/<file_name>.shitFor string specific design decisions, please read DECISIONS.md.
This language is experimental/educational. We don't recommend you use it in production.