Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Cool :).

The thing is to have an always start-to-end working compiler for an increasingly (even if the steps are very small) complex language.

Another point would be to use simple tools at least to begin with. Racket [1] provides good lexer/parser tools [2] and you can use pattern matching [3] to browse and transform your AST. You can also target MIPS assembly [4] using the SPIM platform [5] for example, it is easy to learn and has very good debugging tools (basically the whole platform behaves like a gdb session).

For the compiler implementation language OCaml is also a very good choice (even better because static typing will actually help you a lot with the horizontal approach) but it is less easier to setup as you need to install a lot more tools: ocaml itself, ocamllex (lexer), menhir (parser), ocamlbuild (automated build system), etc.

[1] https://racket-lang.org/

[2] https://docs.racket-lang.org/parser-tools/

[3] https://docs.racket-lang.org/guide/match.html

[4] http://www.cburch.com/cs/330/reading/mips-ref.pdf

[5] http://spimsimulator.sourceforge.net/



Thanks for all the pointers, I didn't know about MIPS assembly, I'll take a look at it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: