About the Project 1 Starter Code
Overview

The starter code distributed as part of this project is totally optional, and it's really designed to remove some of the boilerplate so you can write the code that matters for this course. That being said, it is kinda hefty, so this page serves as a brief walkthrough of what you get.

If you want to use the starter code, maybe start by trying it, and come back here only if you're confused.

Code Files
The following files should be included in the project tarball:
  • frontend.hh: Token definitions (this file will eventually be generated by the parser generator). Do not change this file.
  • position.hpp: Definition for the position class, which tracks the position of the lexeme in the input code. You do not need to change this file, but you are free to do so.
  • errors.hpp: Definition for error-reporting functions. You do not need to change this file, but you are free to do so.
  • scanner.hpp / scanner.cpp: Definition for the scanner class, which will manage the lexical analysis and token printing. You do not need to change this file, but you are free to do so.
  • main.cpp: Contains the entrypoint (i.e. main function) that tests the lexer. You do not need to change this file, but you are free to do so.
  • lexer.hpp: Header declaration for the scanner class. You do not need to change this file, but you are free to do so.
  • levi.l: Flex definition for the scanner class. You should change this file
  • tokens.cpp: Contains the code for printing tokens. You do not need to change this file, but you are free to do so.
  • tokens.hpp: Defintions for the Token class and subclasses. You do not need to change this file, but you are free to do so.
Auxiliary Files
  • Makefile: A Makefile that uses Flex to create a scanner, and also builds the levic binary program. You do not need to change this file, but you are encouraged to do so to create a test suite. You might also want to look at the Makefile, as it demonstrates lots of cool Make features
  • test1.levi: An example test input file you could use to check if your tokenization is working correctly. You do not need to change this file, but you are encouraged to add additional tests, and concatenate rules to the Makefile so that all tests are exercised when the make test target is invoked
  • test1.out.expected and test1.err.expected: An example test
  • TEAM.md: A metadata file to disclose who all worked on the project.