A compiler can be broken down into 4 parts
- tokenize input
- parse into AST
- transform AST
- generate code
- parser: https://pest.rs/
- guideline: https://pest.rs/book/examples/calculator.html
- compiler explained: https://softwareengineering.stackexchange.com/questions/165543/how-to-write-a-very-basic-compiler
- about asts: https://nl.wikipedia.org/wiki/AST
If statements
if (a < b) {
c = 2;
return c;
} else {
c = 3;
}