README.md 2.11 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 folder `interpreter`
     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` and `lexer.h`   
   Source code for the lexer.
      
* `parser.cpp` and `parser.h`   
   Source code for the recursive descent parser.
      
* `main.cpp`    
   Source code for `main` -- the driver.
      
* `Makefile`  
  Used to run `make` (obviously?).
      
* `tests`  
  A directory full of test cases. Run `make tests` 
  (either in directory `tests` 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