|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.vm.CompilerState
public final class CompilerState
This class represents the compiler state during compilation from a given parser.
| Constructor Summary | |
|---|---|
CompilerState(Engine e)
Constructs a new CompilerState to compile and execute code
in the specified engine. |
|
| Method Summary | |
|---|---|
void |
changePackage(Package p)
Changes the current package to the specified one. |
void |
compile(Parser parser)
Compiles the next expression from the supplied parser. |
void |
compileAllowResults(Parser parser,
boolean interactive)
Compiles expressions from the supplied parser, allowing results to be returned by each compiled each expression. |
void |
compileConst(java.lang.String sym,
Expr e)
Compiles the specified expression as the value of a constant variable with the specified symbol. |
void |
compileConstant(java.lang.String sym,
java.lang.Object obj)
Compiles the specified object as a constant value and binds it to the specified symbol. |
void |
compileExpr(Expr e)
Compiles the specified expression and executes it in the engine associated with this compiler state. |
Action |
compileExprToAction(Expr<?> e)
Compiles the specified expression to it's action tree. |
java.lang.Object |
compileExprToValue(Expr<?> e)
Compiles the specified expression, executes it in the engine associated with this compiler state and returns the last result the expression generates. |
void |
compileNoResults(Parser parser)
Compiles expressions from the supplied parser, ensuring no results are returned after compiling each expression. |
GlobalIdent |
declareGlobal(java.lang.String sym)
Declares the specified symbol as a global variable in the current package. |
void |
declareLocalsFrom(int prev)
Declares all the expressions in scope as local variables, from the specified position in the scope stack to the top. |
GlobalIdent |
findIdent(java.lang.String nickname,
java.lang.String sym)
Finds the GlobalIdent for the specified symbol in the specified package. |
boolean |
getIsProtected(java.lang.String sym)
Checks if the specified symbol is protected in the current package. |
java.util.Stack<Expr> |
getScopes()
Returns the stack of scopes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CompilerState(Engine e)
CompilerState to compile and execute code
in the specified engine.
e - the engine to compile and execute code in| Method Detail |
|---|
public void changePackage(Package p)
p - the new current packagepublic boolean getIsProtected(java.lang.String sym)
sym - the symbol to test
true if the symbol is protected in the current
package, false otherwisepublic GlobalIdent declareGlobal(java.lang.String sym)
sym - the symbol to declare as a global
public GlobalIdent findIdent(java.lang.String nickname,
java.lang.String sym)
nickname - the nickname of the package the symbol is insym - the symbol we want to find the Ident for
public java.util.Stack<Expr> getScopes()
public void declareLocalsFrom(int prev)
prev - the position in the scope stack to start declaring as local
variables from
public void compileConstant(java.lang.String sym,
java.lang.Object obj)
sym - the symbol to define as a constobj - the value to make a constant
public void compileConst(java.lang.String sym,
Expr e)
sym - the symbol to define as a conste - the expression for the value of the constpublic void compileExpr(Expr e)
e - the expression to compile and executepublic Action compileExprToAction(Expr<?> e)
e - the expression to compile
public java.lang.Object compileExprToValue(Expr<?> e)
e - the expression to compile and execute
public void compile(Parser parser)
parser - the parser to compile an expression from.public void compileNoResults(Parser parser)
parser - the Parser to read expressions from
public void compileAllowResults(Parser parser,
boolean interactive)
parser - the Parser to read expressions frominteractive - indicates if this compilation is being done from an
interactive mode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||