Class Typecheck
java.lang.Object
Typecheck
public class Typecheck
- extends java.lang.Object
This class is an entry point to the minijava type checker in the
minijava
package. The program's interface is as required by
Homework 2 specification.
Sample usage (where input
is a file containing the input
expression string):
java Typecheck < input
The driver program first parses the source file to create an abstract
syntax tree. A SymbolTableBuilder
then visits the
tree to build a symbol table. This symbol table, in turn, is referenced
by a TypeChecker
visitor as it traverses
statements and expressions in the syntax tree and applies type checking
constraints and rules to it.
If the program type checks, the message "Program type checks
successfully"
is printed. Otherwise, if any problem is encountered along
the way, a TypeException
is caught and the message
"Type error"
is displayed.
- Author:
- Santoso Wijaya
- See Also:
SymbolTableBuilder
,
SymbolTable
,
TypeChecker
Method Summary |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Typecheck
public Typecheck()
main
public static void main(java.lang.String[] args)
throws java.io.IOException,
ParseException
- Throws:
java.io.IOException
ParseException