/Examples

Example projects in flex+bison and SableCC 3

Primary LanguageLex

Examples

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:

  1. linenumbers: Fetching and printing line numbers for tokens and (non-terminal) AST nodes
  2. optional-semicolon: Adding optional semicolons to end of lines (Go like behaviour)
  3. tokens: Printing tokens from the lexer

Additionally, we provide heavily commented versions of the TinyLang scanners and parser written in flex+bison

  1. scanner: flex scanner
  2. scanner+parser: flex scanner, bison parser