public class DefaultInterpreterInterface extends InterpreterInterface
| Modifier and Type | Field and Description |
|---|---|
static DefaultInterpreterInterface |
DEFAULT |
| Constructor and Description |
|---|
DefaultInterpreterInterface() |
| Modifier and Type | Method and Description |
|---|---|
int |
evaluate(AST expression)
Evaluate an abstract syntax tree representing an integer expression and return the final result
|
AST |
parse(ArrayList<Token> tokens)
Convert sequence of tokens into an abstract syntax tree
|
ArrayList<Token> |
tokenize(String input)
Convert input to an list of tokens
|
tokenizeAndParse, tokenizeParseAndEvaluatepublic static final DefaultInterpreterInterface DEFAULT
public ArrayList<Token> tokenize(String input) throws TokenizerException
tokenize in class InterpreterInterfaceinput - the string to be tokenizedTokenizerExceptionpublic AST parse(ArrayList<Token> tokens) throws ParserException
parse in class InterpreterInterfacetokens - the string to be parsedParserExceptionpublic int evaluate(AST expression) throws EvaluatorException
evaluate in class InterpreterInterfaceexpression - the abstract syntax tree to be evaluatedEvaluatorException