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.