Skip to content
Snippets Groups Projects
README.md 2.26 KiB
Newer Older
  • Learn to ignore specific revisions
  • 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 
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
      ** `halfBakedCompiler`  
         This code take mathematical expressions and builds an abstract syntax tree,
         a.k.a. an AST. It then dumps this AST as text. 
         The parsing is equivalent to that in `interpreter` and `interpret++`
         (neighboring directories and predecessor programs).
         This version builds on `interpreter++` (and also requires C++17).
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    See **Chapter 1 Front End Construction**, Slides 22-24 
    (and please let me know when the inevitable day comes 
    when 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.
    
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    Alternatively, just run the program with *no* parameters (i.e. simply `./halfbaker`). 
    
    It will tell you how it wants to be run (Hint: there are two usages).
    
    Contents (Manifest)
    ====================
    
    You should find here:
    
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    * `ast.cpp` and `ast.h`   
       Source code for the AST classes -- the data structures built by the parser.
          
    
    * `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
     
    
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    2 May 2020