Package jminusminus

Class Main

java.lang.Object
jminusminus.Main

public class Main extends Object
Driver class for j-- compiler using hand-written 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

    • Main

      public Main()
  • Method Details

    • main

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