|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Untamed:
Method Summary | |
Object[] |
accumBody(Object verb,
Object rnValue)
Enabled: Actually does the accumulation into the temporary accumulation variable. |
Object[] |
accumFor(Object assoc,
Object collExpr,
Object accumBody)
Enabled: Use a for-loop to accumulate(java.lang.Object, java.lang.Object) for each member of a collection. |
Object[] |
accumIf(Object condExpr,
Object accumBody)
Enabled: Use an if-expr to accumulate(java.lang.Object, java.lang.Object) iff a condition is true. |
EExpr |
accumulate(Object starterExpr,
Object accumulator)
Enabled: Implements the "accumulator" syntax. |
Object[] |
accumWhile(Object condExpr,
Object accumBody)
Enabled: Use a while-loop to accumulate(java.lang.Object, java.lang.Object) while a condition is true. |
EExpr |
asBigAs(Object x,
Object y)
Enabled: |
Assoc |
assoc(Object key,
Object value)
Enabled: Represents a key => value association. |
Pattern |
atNoun(Object token)
Enabled: When an at-hole is '@ |
Pattern |
bindDefiner(Object name)
Enabled: Binds (resolves) a forward declaration. |
Pattern |
bindDefiner(Object name,
Object valueGuardExpr)
Enabled: Binds (resolves) a forward declaration. |
EExpr |
call(Object recipientExpr,
Object verbPos,
String verb,
Object args)
Enabled: |
EExpr |
classExpr(Object doco,
Object classHead,
Object mBody)
Enabled: Supports the deprecated 'class' syntax of old. |
EExpr |
condAnd(Object left,
Object right)
Enabled: left && right => { if (left) { if (right) { [&nameOut, ...] } else { null } } else { null } } =~ [&nameOut, ...] |
EExpr |
condOr(Object left,
Object right)
Enabled: left || right => { if (left) { null =~ [right's outNames - left's outNames] [&nameOut, ...] } else if (right) { null =~ [left's outNames - right's outNames] [&nameOut, ...] } else { null } } =~ [&nameOut, ...] |
Matcher |
delegatex(Object bodyExpr)
Enabled: delegate{expr} expands to match [verb, args] { E call(expr, verb, args) } |
EExpr |
dollarNoun(Object token)
Enabled: When a dollar-hole is '$ |
EExpr |
doMeta(Object keyword,
Object verb,
Object args)
Enabled: Used for pseudo-immediate invocations of the meta or pragma keywords. |
EExpr |
doMeta(Object keyword,
Object verbPos,
String verb,
Object args)
Enabled: |
EExpr |
doMetaSend(Object keyword,
Object verb,
Object args)
Enabled: Used for pseudo-eventual invocations of the meta or pragma keywords. |
EExpr |
doMetaSend(Object keyword,
Object verbPos,
String verb,
Object args)
Enabled: |
EExpr |
ejector(Object ejNoun)
Enabled: |
EExpr |
ejector(Object ejNoun,
Object valExpr)
Enabled: |
Assoc |
exporter(Object nounExpr)
Enabled: '=> nounExpr' expands to '"varName" => nounExpr' |
Pattern |
finalPattern(Object str)
Enabled: |
EExpr |
forward(Object ident)
Enabled: A forward declaration. |
EExpr |
forx(Object assoc,
Object collExpr,
Object mBody)
Enabled: The for loop has the following expansion: for [kPattern =>] vPattern in collExpr { mBody } expands to escape __break { collExpr iterate(def _(k, v) : any { if (k =~ kPattern && v =~ vPattern) { escape __continue { mBody; null } } }) } |
EExpr |
geq(Object x,
Object y)
Enabled: |
EExpr |
get__BREAK()
Enabled: The expression __break. |
EExpr |
get__CONTINUE()
Enabled: The expression __continue. |
EExpr |
get__RETURN()
Enabled: The expression __return. |
EExpr |
getNULL()
Enabled: The expression null. |
EExpr |
getVOID()
Enabled: The expression void. |
EExpr |
greaterThan(Object x,
Object y)
Enabled: |
EExpr |
ifx(Object condExpr,
Object thenExpr)
Enabled: |
Assoc |
importer(Object namerPatt)
Enabled: '=> namerPatt' expands to '"varName" => namerPatt' and '=> (expr) : namerPatt' expands to '"varName" => (expr) : namerPatt' |
EExpr |
leq(Object x,
Object y)
Enabled: |
EExpr |
lessThan(Object x,
Object y)
Enabled: |
EExpr |
macro(Object macroName,
Object optMacroArg,
Object macroBody,
Object optNextMacro)
Enabled: |
Astro |
mangle(Object ident,
String suffix)
Enabled: Mangles an identifier into a variable name by appending a known suffix. |
EExpr |
map(Object assocList)
Enabled: [a => b, c => d] expands to __makeMap fromPairs([[a, b], [c, d]). |
Pattern |
mapPattern(Object assocList,
Object optRestPatt)
Enabled: The pattern |
EExpr |
methObject(Object decl,
Object msgPatt,
Object bodyExpr,
boolean bindReturn)
Enabled: For defining an eScript that consists of exactly one method |
EExpr |
mod(Object val,
Object nModulus)
Enabled: |
EExpr |
mType(Object doco,
Object verb,
Object pTypes,
Object optRetType)
Enabled: |
EExpr |
not(Object x)
Enabled: Convenience for call(x, "not", list()). |
EExpr |
object(Object decl,
Object script)
Enabled: |
ObjDecl |
oDecl(Object optExtends,
Object auditors)
Enabled: |
ObjDecl |
oDecl(Object doco,
Object optOName,
Object oldODecl)
Enabled: |
EExpr |
oType(Object doco,
Object oName,
Object mTypes)
Enabled: |
EExpr |
oType(Object doco,
Object optOName,
Object optAudit,
Object decl,
Object mTypes)
Enabled: |
Pattern |
patternEquals(Object eExpr)
Enabled: (== eExpr) expands to (specimen ? specimen == eExpr) |
Astro |
prop(Object propertyName)
Enabled: Used to transform 'a.name' into 'a.getName(args)'. |
EExpr |
pType(Object optName,
Object optType)
Enabled: |
EExpr |
quasiExpr(Object syntax,
Object quasiList)
Enabled: syntax`foo $bar baz $zip zorp` expands to syntax_quasiParser \ valueMaker("foo ${0} baz ${1} zorp") \ substitute([bar, zip]) |
QuasiLiteralExpr |
quasiLiteralExpr()
Enabled: $$ expands to ${0} |
QuasiLiteralExpr |
quasiLiteralExpr(Object litIndex)
Enabled: |
QuasiLiteralPatt |
quasiLiteralPatt(Object litIndex)
Enabled: |
Pattern |
quasiPattern(Object syntax,
Object quasiList)
Enabled: syntax`foo $bar baz @zip zorp` expands to q ? (syntax__quasiParser \ matchMaker("foo ${0} baz @{0} zorp") \ matchBind([bar], q) =~ [zip]) |
QuasiPatternExpr |
quasiPatternExpr(Object litIndex)
Enabled: |
QuasiPatternPatt |
quasiPatternPatt(Object litIndex)
Enabled: |
EExpr |
same(Object x,
Object y)
Enabled: |
EExpr |
send(Object recipientExpr,
Object verbPos,
String verb,
Object args)
Enabled: |
EExpr |
sequence(Object x,
Object y)
Enabled: |
EExpr |
sequence(Object x,
Object y,
Object z)
Enabled: |
Pattern |
slotDefiner(Object name)
Enabled: |
EExpr |
switchx(Object specimen,
Object matchers)
Enabled: switch (eExpr) { match pattern1 { body1 } match pattern2 { body2 } } expands to { def temp = eExpr if (temp =~ pattern1) { body1 } else if (temp =~ pattern2) { body2 } else { throw("no match: " + temp) } } |
EExpr |
thru(Object start,
Object stop)
Enabled: |
EExpr |
thunk(Object doco,
Object bodyExpr)
Enabled: Expands to |
EExpr |
till(Object start,
Object bound)
Enabled: |
EMethodNode |
to(Object doco,
Object msgPatt,
Object bodyExpr)
Enabled: |
EExpr |
tuple(Object argList)
Enabled: [x, y, z] expands to __makeList(x, y, z) |
EExpr |
update(Object lValue,
Object verb,
Object rnValue)
Enabled: Expands lValue verb= rnValue to lValue := lValue.verb(rnValue), sort of. |
EExpr |
uriExpr(Object uriToken)
Enabled: uriToken must be a URI, and have both protocol and body. |
EExpr |
uriExpr(Object uriStartToken,
Object uriBodyExpr)
Enabled: uriStartToken must be a URIStart, and must have a protocol, but no body. |
Astro |
varName(Object ident)
Enabled: Make vacancies for new temporary variable names. |
Pattern |
varPattern(Object name)
Enabled: |
EExpr |
when(Object headList,
Object bodyExpr,
Object catchers,
Object optFinally)
Enabled: |
EExpr |
whilex(Object condExpr,
Object bodyExpr)
Enabled: The while loop expands as follows: while (cond) { body } expands to escape __break { __loop( def _() :boolean { if (cond) { escape __continue { body } true } else { false } }) } |
Methods inherited from interface org.erights.e.elang.syntax.BaseEBuilder |
antiPocket, append, assign, call, cdrPattern, define, escape, finalPattern, hide, ifx, ignore, list, list, list, list, list, listPattern, literal, matchBind, matcher, methHead, method, oDecl, pocket, reserved, send, sequence, slotExpr, suchThat, tryx, varPattern, vTable, with |
Method Detail |
public EExpr getNULL()
null is bound in the universal scope to the one null value. In E-on-Java, this is the same as Java null.
public EExpr getVOID()
void is bound in the universal scope to a guard that coerces all values to null.
public EExpr get__BREAK()
The for and while loop expansions include an escape __break {..., putting a variable of this name into scope. The keyword break expands to a call to __break.
public EExpr get__CONTINUE()
The for and while loop expansions include an escape __continue {..., putting a variable of this name into scope. The keyword continue expands to a call to __continue.
public EExpr get__RETURN()
The keyword return expands to a call to __return.
public EExpr update(Object lValue, Object verb, Object rnValue)
When x is a variable name,
x "verb=" z expands to x := x.verb(z)Otherwise, we need to ensure that the lValue's subexpressions are only evaluated once
x.v(y...).verb= zexpands to
def r := x def a0 := y ... r.v(a0...) := r.v(a0...).verb(z)And then the
assignment expansions
take it from there.
public EExpr call(Object recipientExpr, Object verbPos, String verb, Object args)
public EExpr send(Object recipientExpr, Object verbPos, String verb, Object args)
public EExpr not(Object x)
Makes the expression x.not()
public EExpr doMeta(Object keyword, Object verb, Object args)
This is a bit of a syntactic hack, to enable the creation of new special forms without extending the BNF of the language. Rather, if meta or pragma appear as the receiver of what otherwise would have been an immediate-call expression, then the builder should dispatch on the verb and arity of the arguments to figure out what to do.
ScopeExpr
expression,
but can instead be done (and probably should be done) by expanding
the current scope into a map-creation expression. This expansion
would need to be done after scope analysis of course, which isn't
straightforward in the current transformation architecture.
Evaluator
,
expr)' is reserved for future use. See
Evaluator
.
public EExpr doMeta(Object keyword, Object verbPos, String verb, Object args)
public EExpr doMetaSend(Object keyword, Object verb, Object args)
This is a bit of a syntactic hack, to enable the creation of new special forms without extending the BNF of the language. Rather, if meta or pragma appear as the receiver of what otherwise would have been an eventual-send expression, then the builder should dispatch on the verb and arity of the arguments to figure out what to do.
Evaluator
,
expr)' is reserved for future use. See
Evaluator
.
public EExpr doMetaSend(Object keyword, Object verbPos, String verb, Object args)
public EExpr classExpr(Object doco, Object classHead, Object mBody)
Enabled by 'pragma.enable("class-expr")'.
class foo(patts) :rt {body)expands to
def maker$n := def foo { to adopt(self, patts) :rt {body} to run(params) :rt { def self$n := maker$n adopt(self$n, params) } }
public EExpr condAnd(Object left, Object right)
public EExpr condOr(Object left, Object right)
public Pattern finalPattern(Object str)
public Pattern varPattern(Object name)
public Pattern slotDefiner(Object name)
public EExpr dollarNoun(Object token)
public EExpr forward(Object ident)
"def name" expands to
(def [name, name__Resolver] := Ref.promise(); name__Resolver)The value of a "def name" expression is the Resolver that will resolve 'name', so, for example, '(def name)' can be used in an argument position both to define 'name' and to pass the Resolver as an argument to someone who will resolve it.
public Pattern bindDefiner(Object name)
"bind name" expands to
temp ? (name__Resolver.resolve(temp); true)
public Pattern bindDefiner(Object name, Object valueGuardExpr)
"bind name :valueGuard" expands to
temp :valueGuard ? (name__Resolver.resolve(temp); true)
public ObjDecl oDecl(Object optExtends, Object auditors)
public ObjDecl oDecl(Object doco, Object optOName, Object oldODecl)
public EExpr object(Object decl, Object script)
public Matcher delegatex(Object bodyExpr)
public EExpr ejector(Object ejNoun)
public EExpr ejector(Object ejNoun, Object valExpr)
public EExpr forx(Object assoc, Object collExpr, Object mBody)
assoc
- An Assoc
of kPattern and a vPattern.collExpr
- Evaluates to the collection to be iterated (to be sent
the "iterate" message).mBody
- The body of the for-loop.
public EExpr accumulate(Object starterExpr, Object accumulator)
The "accumulator" syntax has most of the advantages of list comprehension (from Haskell and Python), but is more E-like. For example, with this property enabled, one can write:
[] for i in 1..5 { + i**2 }to accumulate the list [ 1, 4, 9, 16, 25 ]. This expands into
{ var accum_n := [] for i in 1..5 { accum_n += { i**2 } } accum_n }Note that this is more flexible but more verbose than a list comprehension, and less flexible and comparably verbose to a Smalltalk injection.
More formally, the transformation is from
starterExpr accumulatorto
{ var accum_n := starter-expr accumExpr accum_n }where accumulator is one of
accumFor(java.lang.Object, java.lang.Object, java.lang.Object)
, accumIf(java.lang.Object, java.lang.Object)
,
or accumWhile(java.lang.Object, java.lang.Object)
. They each have an accumBody parameter. The
corresponding argument is one of accumFor(java.lang.Object, java.lang.Object, java.lang.Object)
, accumIf(java.lang.Object, java.lang.Object)
,
accumWhile(java.lang.Object, java.lang.Object)
, or accumBody(java.lang.Object, java.lang.Object)
, and returns a pair of
the name of the temporary variable (shown as "accum-n" above) and
an expression (shown as "accumExpr" above).
starterExpr
- The initial value to be accumulated on to.accumulator
- A pair of a temp-name and an accumExpr.
public Object[] accumFor(Object assoc, Object collExpr, Object accumBody)
accumulate(java.lang.Object, java.lang.Object)
for each member of a collection.
assoc
- An Assoc
of a key-pattern and a value-pattern.collExpr
- Evaluates to the collection to be iterated (to be sent
the "iterate" message).accumBody
- A pair of a temp-name and an accumExpr.
public Object[] accumIf(Object condExpr, Object accumBody)
accumulate(java.lang.Object, java.lang.Object)
iff a condition is true.
public Object[] accumWhile(Object condExpr, Object accumBody)
accumulate(java.lang.Object, java.lang.Object)
while a condition is true.
public Object[] accumBody(Object verb, Object rnValue)
verb
- The messageName that says how the temporary should
be updated.rnValue
- The argument-list for computing a new value.
temp-name verb= rnValue
public EExpr ifx(Object condExpr, Object thenExpr)
public EExpr lessThan(Object x, Object y)
public EExpr leq(Object x, Object y)
public EExpr asBigAs(Object x, Object y)
public EExpr geq(Object x, Object y)
public EExpr greaterThan(Object x, Object y)
public EExpr till(Object start, Object bound)
public EExpr thru(Object start, Object stop)
public EExpr macro(Object macroName, Object optMacroArg, Object macroBody, Object optNextMacro)
public EExpr map(Object assocList)
This exapansion satisfies the requirement that it preserves order.
public Pattern mapPattern(Object assocList, Object optRestPatt)
[k1 => v1, ...where kn is an expression and v1 is a pattern, expands to
m1 ? m1.optExtract
(k1) =~ [v1, ...]
If the original ends in "| restPatt", then restPatt is used in the
final "..." in the expansion. Otherwise, the final "..." is filled
with 'mn ? mn.size() == 0'.
To support default values, an individual association can also be
k1 else (defaultExpr1) => v1which will expand using
m1.extract
(k1, defaultExpr1)
If k1 isn't in the table, then the value of defaultExpr1 is matched
against v1 rather than failing.
Note that this expansion carefully preserves left-to-right order, so latter patterns and expressions can use bindings and side effects produced by earlier ones. In particular, if execution gets as far as a defaultExpr, it is evaluated whether or not its value is used.
public Assoc assoc(Object key, Object value)
It depends on context whether either key of value is an expression or a pattern.
public Assoc exporter(Object nounExpr)
public Assoc importer(Object namerPatt)
public EExpr mod(Object val, Object nModulus)
public EExpr thunk(Object doco, Object bodyExpr)
def _() :any { bodyExpr }
public EMethodNode to(Object doco, Object msgPatt, Object bodyExpr)
public EExpr methObject(Object decl, Object msgPatt, Object bodyExpr, boolean bindReturn)
public Pattern patternEquals(Object eExpr)
public Pattern atNoun(Object token)
public EExpr quasiExpr(Object syntax, Object quasiList)
public QuasiLiteralExpr quasiLiteralExpr()
public QuasiLiteralExpr quasiLiteralExpr(Object litIndex)
public QuasiLiteralPatt quasiLiteralPatt(Object litIndex)
public Pattern quasiPattern(Object syntax, Object quasiList)
public QuasiPatternExpr quasiPatternExpr(Object litIndex)
public QuasiPatternPatt quasiPatternPatt(Object litIndex)
public EExpr same(Object x, Object y)
public EExpr sequence(Object x, Object y)
public EExpr sequence(Object x, Object y, Object z)
public EExpr switchx(Object specimen, Object matchers)
public EExpr tuple(Object argList)
public EExpr uriExpr(Object uriToken)
<http:foo> expands to http__uriGetter["foo"]. <x:foo> expands to file__uriGetter["x:foo"].
public EExpr uriExpr(Object uriStartToken, Object uriBodyExpr)
<http: expr> expands to http__uriGetter[expr] <x: expr> expands to file__uriGetter["x:" + expr]
public EExpr whilex(Object condExpr, Object bodyExpr)
public EExpr oType(Object doco, Object oName, Object mTypes)
public EExpr oType(Object doco, Object optOName, Object optAudit, Object decl, Object mTypes)
public EExpr mType(Object doco, Object verb, Object pTypes, Object optRetType)
public EExpr pType(Object optName, Object optType)
public Astro varName(Object ident)
ident
- An Astro representing the identifier as it appears in the
source code.
public Astro mangle(Object ident, String suffix)
ident
- An Astro representing the identifier as it appears in the
source code.
public Astro prop(Object propertyName)
'name' is changed into 'Name' using the standard JavaBeans rule: 'toUpperCase' is applied to the name[0].
As a result of the assignment conversion rules, 'a.name := y' is trasformed into 'a.setName(y)'
propertyName
- An Astro representing the identifier as it appears
in the source code.
public EExpr when(Object headList, Object bodyExpr, Object catchers, Object optFinally)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |