Work in progress!
-
typechecking instead of runtime casting
-
make operators built in functions
-
implement mixfix parsing (see above)
-
Unit tests for unit testable stuff
-
Check
std::shared_ptr
usage
- Two level language: https://dl.acm.org/doi/10.5555/130665, https://arxiv.org/pdf/cs/9810010.pdf
- Compile with LLVM
- STM
I personally don't like code generation, as it's pretty hard to debug, and involves mushing together strings in an extremely error-prone way. Since there aren't that many classes involved (yet! still to be seen if this holds up), I just typed them out manually.
Since expressions are represented by std::shared_ptr
s, it's pretty easy to "pattern match" by "std::dynamic_pointer_cast"-ing
in a cascade of if
s. Another possibility would have been to use std::variant
and std::visit
.
The book completely glosses over testing, which (in my opinion) is not a great thing, testing interpreters/compilers is far from trivial. I use approval tests for parsing.