Overview
Everything here is taken from the slides for the "Compiler Construction" course, i.e. it is directly from Prof. Ronald C. Moore.
Or at least, after all this time, I really don't remember having stolen this code from somewhere else, but if you find an older copy that looks similar, please let me know, so I can give credit where credit is due -- or disavow knowledge of that source (as the case may be).
You are in the following subdirectory
-
interpret++
This code take mathematical expressions and evaluates them, i.e. it outputs numbers. It is the same as its sister folderinterpreter
as far as recursive descent parsing goes, but uses more C++ features and is set up so as to support growing up to be a larger project.
See Chapter 1 Front End Construction, Slides 21 and 22 (and please let me know when the inevitable day comes that these slide numbers are no longer correct).
Building and Running
This version requires a C++17 compatible C++ compiler,
such as newer versions of g++
or clang
.
Build the program by running make
.
In case of doubt, use the voodo command make clean
and then repeat make
.
To test the program, run make tests
. This also illustrates how the intepreter is used.
Alternatively, just run the program with no parameters (i.e. simply ./intepret++
).
It will tell you how it wants to be run (Hint: there are two usages).
Contents (Manifest)
You should find here:
-
lexer.cpp
andlexer.h
Source code for the lexer. -
parser.cpp
andparser.h
Source code for the recursive descent parser. -
main.cpp
Source code formain
-- the driver. -
Makefile
Used to runmake
(obviously?). -
tests
A directory full of test cases. Runmake tests
(either in directorytests
or the parent directory) to run the tests. Not unit tests, rather acceptance tests, but regression tests all the same. -
README.md
This file.
Ronald Moore
https://fbi.h-da.de/personen/ronald-moore/
ronald.moore@h-da.de
1 May 2020