public static class Expression.Binary extends Expression
Expression.Application
.Expression.Application, Expression.Binary, Expression.Block, Expression.Const, Expression.Ident, Expression.IfExp, Expression.LambdaExp, Expression.Tuple, Expression.Unary
Modifier and Type | Field and Description |
---|---|
Expression |
lft
lft and rgt, the left and right sub-Expressions.
|
int |
opr
The binary operator, e.g., '+', etc..
|
Expression |
rgt
lft and rgt, the left and right sub-Expressions.
|
Constructor and Description |
---|
Binary(int opr,
Expression lft,
Expression rgt) |
Modifier and Type | Method and Description |
---|---|
void |
appendSB(java.lang.StringBuffer sb)
The use of a StringBuffer, sb, gives linear complexity when
printing large Values; also see
Expression.toString() . |
Value |
eval(Environment r)
|
int |
n()
n(), the numerical code (tag) of a subclass of Expression,
for example, for switch-ing.
|
defer, error, toString
public final int opr
public final Expression lft
public final Expression rgt
public Binary(int opr, Expression lft, Expression rgt)
public int n()
Expression
n
in class Expression
public Value eval(Environment r)
opr
, to
lft
and rgt
sub-Expressions
in the given Environment 'r'.
Note, 'cons' is lazy, 'and' & 'or' are half-lazy,
'+', '*', etc., are strict.eval
in class Expression
public void appendSB(java.lang.StringBuffer sb)
Expression
Expression.toString()
.appendSB
in class Expression