public class NovaEqdfCompiler extends java.lang.Object implements IEqdfCompiler
IEqdfCompiler
String
into a token stream, then turns that into
a symbol stream, which is used to build the AST (Abstract Syntax Tree).
The bytecode is then created from the AST.Nodes in AST
Modifier and Type | Class and Description |
---|---|
protected static class |
NovaEqdfCompiler.BoolWrapper |
protected static class |
NovaEqdfCompiler.EnumTokenType |
protected static class |
NovaEqdfCompiler.Token |
Constructor and Description |
---|
NovaEqdfCompiler() |
Modifier and Type | Method and Description |
---|---|
protected static SyntaxNode |
astBuild(java.util.Queue<NovaEqdfCompiler.Token> tokenStream)
Builds the AST from the token stream
|
protected static java.util.List<java.lang.Object> |
astCompile(SyntaxNode node)
Compiles the AST into bytecode
|
void |
clean()
Reset the compiler to a clean state
|
MathContext |
compile(java.lang.String s)
Compiles the string
|
protected static SyntaxNode |
getNextExpr(java.util.Queue<NovaEqdfCompiler.Token> tokenStream,
NovaEqdfCompiler.BoolWrapper endOfStream)
Get the next expression
|
protected static SyntaxNode |
getNextNode(SyntaxNode last,
java.util.Queue<NovaEqdfCompiler.Token> tokenStream)
You better make node of that!
|
protected java.util.Queue<NovaEqdfCompiler.Token> |
tokenize(java.lang.String s)
Tokenizes the
String |
public void clean()
IEqdfCompiler
clean
in interface IEqdfCompiler
public MathContext compile(java.lang.String s)
IEqdfCompiler
compile
in interface IEqdfCompiler
protected java.util.Queue<NovaEqdfCompiler.Token> tokenize(java.lang.String s)
String
protected static SyntaxNode astBuild(java.util.Queue<NovaEqdfCompiler.Token> tokenStream)
protected static SyntaxNode getNextNode(SyntaxNode last, java.util.Queue<NovaEqdfCompiler.Token> tokenStream)
protected static SyntaxNode getNextExpr(java.util.Queue<NovaEqdfCompiler.Token> tokenStream, NovaEqdfCompiler.BoolWrapper endOfStream)
tokenStream
- the token streamendOfStream
- a flag, which will be set to true if the expression was terminated by ')', false if by ','protected static java.util.List<java.lang.Object> astCompile(SyntaxNode node)