public abstract class Parser extends Object
A language-independent framework class. This abstract parser class will be implemented by language-specific subclasses.
Copyright (c) 2009 by Ronald Mak
For instructional purposes only. No warranties.
Modifier | Constructor and Description |
---|---|
protected |
Parser(Scanner scanner,
ExceptionHandler exceptionHandler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Token |
currentToken()
Call the scanner's currentToken() method.
|
abstract int |
getErrorCount()
Return the number of syntax errors found by the parser.
|
EventDispatcher |
getEventDispatcher() |
ExceptionHandler |
getExceptionHandler() |
Scanner |
getScanner()
Getter.
|
Source |
getSource() |
Token |
nextToken()
Call the scanner's nextToken() method.
|
abstract ASTNode |
parse()
Parse a source program and generate the intermediate code and the symbol
table.
|
Token |
previousToken() |
protected Scanner scanner
protected Parser(Scanner scanner, ExceptionHandler exceptionHandler)
scanner
- the scanner to be used with this parser.public ExceptionHandler getExceptionHandler()
public Scanner getScanner()
public EventDispatcher getEventDispatcher()
public abstract ASTNode parse() throws Exception
Exception
- if an error occurred.public abstract int getErrorCount()
public Token previousToken()
public Token currentToken()
public Token nextToken() throws IOException
Exception
- if an error occurred.IOException
Copyright © 2010–2015. All rights reserved.