Compiler tools are complex, and sometimes have hidden functionality to extend the basics that we cover in class. We provide 3 examples written in both flex+bison and SableCC to get you started with your assignments:
linenumbers
: Fetching and printing line numbers for tokens and (non-terminal) AST nodesoptional-semicolon
: Adding optional semicolons to end of lines (Go like behaviour)tokens
: Printing tokens from the lexer
Additionally, we provide heavily commented versions of the TinyLang scanners and parser written in flex+bison
scanner
: flex scannerscanner+parser
: flex scanner, bison parser