Package jminusminus

Class JavaCCMain

java.lang.Object
jminusminus.JavaCCMain

public class JavaCCMain extends Object
Driver class for j-- compiler using JavaCC front-end. This is the main entry point for the compiler. The compiler proceeds as follows:
  1. It reads arguments that affects its behavior.
  2. It builds a scanner.
  3. It builds a parser (using the scanner) and parses the input for producing an abstact syntax tree (AST).
  4. It sends the preAnalyze() message to that AST, which recursively descends the tree so far as the member headers for declaring types and members in the symbol table (represented as a string of contexts).
  5. It sends the analyze() message to that AST for declaring local variables, and checking and assigning types to expressions. Analysis also sometimes rewrites some of the abstract syntax tree for clarifying the semantics. Analysis does all of this by recursively descending the AST down to its leaves.
  6. Finally, it sends a codegen() message to the AST for generating code. Again, codegen() recursively descends the tree, down to its leaves, generating JVM code for producing a .class or .s (SPIM) file for each defined type (class).
  • Constructor Details

    • JavaCCMain

      public JavaCCMain()
  • Method Details

    • main

      public static void main(String[] args)
      Entry point.
      Parameters:
      args - the command-line arguments.