plum-umd / the-838e-compiler

Compiler for CMSC 838E
2 stars 0 forks source link

Vectors #47

Closed aaron-green19 closed 3 years ago

aaron-green19 commented 3 years ago

Added support for vectors, mirroring https://docs.racket-lang.org/reference/vectors.html

Vectors can be created via:

They also are printed and read in similar to racket, starting with #(, however there is not yet support for putting a number in between the # and the (

The main difference between directly writing Vector literals and using (vector v ...) is that the former works with a smaller set of values than the latter, partially because I'm not sure the best way how to make it work great with lists. Writing the literal does not evaluate anything inside of it, while using the vector keyword will evaluate the expressions within.

I also implemented the functions