|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.expr.Expr<A>
public abstract class Expr<A extends Action>
This class represents the base class of all expressions in MillScript. As such any new type of expression must extend this class, or one of it's more specific subclasses. An expression is the result of parsing syntax, and is the middle stage of compiling to actions.
Action,
Syntax| Constructor Summary | |
|---|---|
Expr()
|
|
| Method Summary | |
|---|---|
int |
arity()
Returns the arity of this expression. |
A |
compile()
Compiles this expression into an action, setting the context of the action. |
abstract A |
compileIt()
Compiles this expression into an action. |
static java.lang.Integer |
isIntegerExpr(Expr x)
Checks if the specified expression is a constant integer and returns it. |
abstract void |
resolve(CompilerState state)
Resolves any NameExpr in the tree so that they refer to the
correct ident. |
static void |
resolveList(CompilerState state,
org.millscript.commons.util.IList<? extends Expr> list)
Resolves all the expressions in the specified list, by calling the resolve(CompilerState) method on each one in turn. |
void |
setLineNumber(int n)
Sets the line number of this expression in the origin. |
void |
setOrigin(java.lang.String x)
Sets the origin of this expression. |
void |
show()
Displays details about this expression, starting with no indent. |
void |
show(int n)
Displays details about this expression, with the specified indent level. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Expr()
| Method Detail |
|---|
public static final java.lang.Integer isIntegerExpr(Expr x)
x - the expression to check
null or an Integer if the expression represents a
constant integer
public static void resolveList(CompilerState state,
org.millscript.commons.util.IList<? extends Expr> list)
resolve(CompilerState) method on each one in turn.
state - the compiler state we are resolving inlist - the list of expressions to resolvepublic int arity()
0 if the expression returns zero results,
1 if the expression returns one result or
-1 if the expression returns an unknown number of
results.public A compile()
Action for this expression, with it's context set.public abstract A compileIt()
Action for this expressionpublic abstract void resolve(CompilerState state)
NameExpr in the tree so that they refer to the
correct ident. e.g. This method is responsible for ensuring that
references to a function argument in the body of a function actually
refer to the correct value.
state - the compiler state we are resolving inpublic void setLineNumber(int n)
n - the line number at which this expression appears in the
given originpublic void setOrigin(java.lang.String x)
x - a String describing this expressions originpublic void show()
public void show(int n)
n - the indent level at which to start displaying
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||