Package jminusminus
Class Main
java.lang.Object
jminusminus.Main
Driver class for j-- compiler using hand-written front-end. This is the main entry point for
the compiler. The compiler proceeds as follows:
- It reads arguments that affects its behavior.
- It builds a scanner.
- It builds a parser (using the scanner) and parses the input for producing an abstact syntax tree (AST).
- 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).
- 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.
- 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 Summary
-
Method Summary
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
main
Entry point.- Parameters:
args
- the command-line arguments.
-