This is a being written for compiler for CSC-312.
If you don't already have stack, you can obtain it by running
$ curl -sSL https://get.haskellstack.org/ | sh
More detailed instructions can be found in the Stack guide. The project should also be buildable with cabal, but you may need to offer a blood sacrifice to Haskell Curry to ensure a successful build.
To build the project, run
$ stack build
To run the project, run
$ stack exec compiler
Arguments must passed after a --
so that they are passed to compiler
rather
than stack
.
$ stack exec compiler -- foo bar baz
To run the test suite, run
$ stack test
The syntax is
exp := exp + exp
| exp - exp
| exp * exp
| exp / exp
| exp <= exp
| exp : exp
| if exp then exp else exp
| let x = exp in exp
| fun x -> exp
| fix f x -> exp
| exp exp
- Single line comments (-- comment)
- Nested, multi-line comments ({- comment -})
- A REPL
- No more state (you said this was fine)
- Type inference hasn't been fixed yet
- Mutable variables and arrays
- While loops
- None
- Type inference hasn't been fixed yet
I'm using a token on this one
- Types and type anotations
- Mostly functional type inference
- Expressions must be well typed
- The typechecker sometimes infers an overly general type
- Let bindings and lambdas
- Operators now bind very loosely, to allow expressions like "3 + f 4" to be parsed as "3 + (f 4)" rather than "(3 + f) 4", and following the syntax given in the Haskell 2010 report. Precedence among the operators is unchanged.
- still none
- Somewhat accurate location information in errors
- The test suite is more robust
- The syntax now uses infix notation
- The less than or equal to operator is non associative and binds the loosest
- Addition and subtraction are left associative and bind tighter than less than or equal to
- Multiplication and division are left associative and bind tighter than addition and subtraction
- still none
- A lexer
- A parser
- An interpreter
- It now compiles things instead of spitting back text
- still none
- Created the project
- Parse command line options
- Test suite
- N/A
- none