org.erights.e.elang.syntax
Class ENodeBuilder

java.lang.Object
  |
  +--org.erights.e.elang.syntax.BaseENodeBuilder
        |
        +--org.erights.e.elang.syntax.ENodeBuilder
All Implemented Interfaces:
BaseEBuilder, EBuilder

public class ENodeBuilder
extends BaseENodeBuilder
implements EBuilder

Untamed:


Field Summary
private static EExpr __BREAK
           
private static EExpr __CONTINUE
           
private static EExpr __RETURN
           
private static EExpr ANY
           
private static EExpr BOOLEAN
           
private static EExpr COMPARER
           
private static EExpr DEFINESLOT
           
private static EExpr EE
           
private static EExpr EQUALIZER
           
private static EExpr FALSE
           
private static EExpr LOOP
           
private static EExpr MAKE_LIST
           
private static EExpr MAKE_MAP
           
private static EExpr MAKE_MSG
           
private static EExpr MAKE_ORDERED_SPACE
           
private static EExpr MAKE_PARAM
           
private static EExpr MAKE_PROT
           
private  HilbertHotel myHilbert
           
private static EExpr[] NO_EEXPRS
           
private static EExpr NULL
           
private static EExpr PROMISE_ALL_FULFILLED
           
private static EExpr REF
           
private static EExpr SETTABLE
           
private static EExpr THROW
           
private static EExpr TRUE
           
private static EExpr VOID
           
 
Fields inherited from class org.erights.e.elang.syntax.BaseENodeBuilder
myLexer, myProps
 
Constructor Summary
ENodeBuilder(ConstMap props, LexerFace lexer)
          Enabled:
 
Method Summary
 Object[] accumBody(Object verb, Object rnValue)
          Enabled:
 Object[] accumFor(Object assoc, Object collExpr, Object accumBody)
          Enabled:
 Object[] accumIf(Object condExpr, Object accumBody)
          Enabled:
 EExpr accumulate(Object starterExpr, Object accumulator)
          Enabled:
 Object[] accumWhile(Object condExpr, Object accumBody)
          Enabled:
private  EExpr[] antiCycle(FlexMap conflicts)
          Expand a left-pattern and an rValue that might cause a circularity into a sequence of expressions without this circularity, except that the place for the expression itself has a null as a placeholder.
 EExpr asBigAs(Object x, Object y)
          Enabled:
 EExpr assign(Object lValue, Object rValue)
          Enabled:
 Assoc assoc(Object key, Object value)
          Enabled:
 Pattern atNoun(Object token)
          Enabled: When an at-hole is '@' or '@_'
 Pattern bindDefiner(Object identOrStr)
          Enabled:
 Pattern bindDefiner(Object identOrStr, Object valueGuardExpr)
          Enabled:
 EExpr call(Object recipientExpr, Object verbPos, String verb, Object args)
          Enabled:
 EExpr classExpr(Object doco, Object classHead, Object mBody)
          Enabled:
 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, ...]
 EExpr define(Object pattern, Object rValue)
          Enabled:
 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:
 EExpr doMeta(Object keyword, Object verbPos, String verb, Object args)
          Enabled:
 EExpr doMetaSend(Object keyword, Object verb, Object args)
          Enabled:
 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:
 Pattern finalPattern(Object str)
          Enabled:
 EExpr forward(Object identOrStr)
          Enabled: A forward declaration.
 EExpr forx(Object assoc, Object collExpr, Object mBody)
          Enabled:
 EExpr geq(Object x, Object y)
          Enabled:
 EExpr get__BREAK()
          Enabled:
 EExpr get__CONTINUE()
          Enabled:
 EExpr get__RETURN()
          Enabled:
 EExpr getNULL()
          Enabled:
 EExpr getVOID()
          Enabled:
 EExpr greaterThan(Object x, Object y)
          Enabled:
private  Astro ident(Object original, String newStr)
          Makes an identifier token whose value is 'newStr', and whose source is derived from 'original'.
 EExpr ifx(Object condExpr, Object thenExpr)
          Enabled:
 Assoc importer(Object namerPatt)
          Enabled:
 EExpr leq(Object x, Object y)
          Enabled:
 EExpr lessThan(Object x, Object y)
          Enabled:
private  EExpr[] lValuePair(EExpr lValue)
          Return a pair of an optional prelude expression and an access expression, used to access of modify an lValue without recomputing the lValue expression.
 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]) This exapansion satisfies the requirement that it preserves order.
 Pattern mapPattern(Object assocList, Object optRestPatt)
          Enabled:
private  EExpr matchExpr(Matcher[] matchers, Astro varName, EExpr optOtherwise)
           
 EExpr methObject(Object decl, Object msgPatt, Object bodyExpr, boolean bindReturn)
          Enabled: For defining an eScript that consists of exactly one method
private  EScriptDecl methScriptDecl(Object msgPatt, Object bodyExpr, boolean bindReturn)
          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:
private  Astro newTemp(Object identOrString)
          generate 'unique' temporary variable names for transformations.
 EExpr not(Object x)
          Enabled:
 EExpr object(Object decl, Object script)
          Enabled:
private  EExpr object(String docComment, Object optOName, EExpr optSuperExpr, EExpr[] impls, EScriptDecl script)
           
 ObjDecl oDecl(Object optExtends, Object auditors)
          Enabled:
 ObjDecl oDecl(Object doco, Object optOName, Object oldODecl)
          Enabled:
(package private)  Matcher optMatcher(Object matchers)
           
private  EExpr oType(LiteralExpr docComment, Object optOName, Pattern optAuditorPatt, EExpr optExtends, EExpr auditorTuple, EExpr msgTuple)
           
 EExpr oType(Object doco, Object oName, Object mTypes)
          Enabled:
 EExpr oType(Object doco, Object optOName, Object optAudit, Object decl, Object mTypes)
          Enabled:
private  EExpr oTypeBase(LiteralExpr docComment, Pattern optGuardPatt, Pattern optAuditorPatt, EExpr qualName, EExpr auditorTuple, EExpr msgTuple)
           
 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 slotExpr(Object eExpr)
          Enabled:
private  Pattern slotsPattern(Object[] names)
          Given an array of names, return a tuple pattern that will bind all these names to slots when matched with an array of slots with the same shape.
private  EExpr slotsTuple(Object[] names)
          Given an array of names, return an expression that will make a tuple from the slots of the variables of these names
 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 tryx(Object eExpr, Object catchers, Object optFinally)
          Enabled:
 EExpr tuple(Object argList)
          Enabled: [x, y, z] expands to __makeList(x, y, z)
 EExpr update(Object lValue, Object verb, Object rnValue)
          Enabled:
 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 identOrStr)
          Enabled: Make vacancies for new temporary variable names.
 Pattern varPattern(Object name)
          Enabled:
 EExpr when(Object headList, Object bodyExpr, Object catchers, Object optFinally)
          Enabled:
private  EExpr whenBase(EExpr eExpr, ObjDecl objDecl, Pattern patt1, EExpr resultGuard, EExpr body1, Object catchers, Object optFinally)
          Then when statement base-case expands as follows:
private  EExpr whenList(EExpr[] eExprs, ObjDecl objDecl, Pattern[] patts, EExpr resultGuard, EExpr body1, Object catchers, Object optFinally)
          Then normal when statement syntax expands as follows:
 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 class org.erights.e.elang.syntax.BaseENodeBuilder
antiPocket, append, call, cdrPattern, docComment, escape, exprs, finalPattern, hide, ident, idStr, ifx, ignore, list, list, list, list, list, listPattern, literal, matchBind, matcher, methHead, method, noun, object, oDecl, pocket, reserved, send, sequence, suchThat, syntaxError, typedArray, varPattern, vTable, with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.erights.e.elang.syntax.BaseEBuilder
antiPocket, append, call, cdrPattern, escape, finalPattern, hide, ifx, ignore, list, list, list, list, list, listPattern, literal, matchBind, matcher, methHead, method, oDecl, pocket, reserved, send, sequence, suchThat, varPattern, vTable, with
 

Field Detail

NULL

private static final EExpr NULL

FALSE

private static final EExpr FALSE

TRUE

private static final EExpr TRUE

THROW

private static final EExpr THROW

LOOP

private static final EExpr LOOP

MAKE_LIST

private static final EExpr MAKE_LIST

MAKE_MAP

private static final EExpr MAKE_MAP

MAKE_PROT

private static final EExpr MAKE_PROT

MAKE_MSG

private static final EExpr MAKE_MSG

MAKE_PARAM

private static final EExpr MAKE_PARAM

SETTABLE

private static final EExpr SETTABLE

DEFINESLOT

private static final EExpr DEFINESLOT

ANY

private static final EExpr ANY

VOID

private static final EExpr VOID

BOOLEAN

private static final EExpr BOOLEAN

MAKE_ORDERED_SPACE

private static final EExpr MAKE_ORDERED_SPACE

EQUALIZER

private static final EExpr EQUALIZER

COMPARER

private static final EExpr COMPARER

REF

private static final EExpr REF

EE

private static final EExpr EE

PROMISE_ALL_FULFILLED

private static final EExpr PROMISE_ALL_FULFILLED

__BREAK

private static final EExpr __BREAK

__CONTINUE

private static final EExpr __CONTINUE

__RETURN

private static final EExpr __RETURN

NO_EEXPRS

private static final EExpr[] NO_EEXPRS

myHilbert

private final HilbertHotel myHilbert
Constructor Detail

ENodeBuilder

public ENodeBuilder(ConstMap props,
                    LexerFace lexer)
Enabled:

Method Detail

getNULL

public EExpr getNULL()
Enabled:

Specified by:
getNULL in interface EBuilder

getVOID

public EExpr getVOID()
Enabled:

Specified by:
getVOID in interface EBuilder

get__BREAK

public EExpr get__BREAK()
Enabled:

Specified by:
get__BREAK in interface EBuilder

get__CONTINUE

public EExpr get__CONTINUE()
Enabled:

Specified by:
get__CONTINUE in interface EBuilder

get__RETURN

public EExpr get__RETURN()
Enabled:

Specified by:
get__RETURN in interface EBuilder

assign

public EExpr assign(Object lValue,
                    Object rValue)
Enabled:

Specified by:
assign in interface BaseEBuilder
Overrides:
assign in class BaseENodeBuilder

lValuePair

private EExpr[] lValuePair(EExpr lValue)
Return a pair of an optional prelude expression and an access expression, used to access of modify an lValue without recomputing the lValue expression.

In expanding

     x[foo()][bar()] += 3
it's important that x[foo()] and bar() only be evaluated once. This evaluation happens in the prelude, leaving the resulting values in temporary variables, let's say t1 and t2 used by the access expression.

The access expression would then be t1[t2], ie, t1.get(t2). By the assignment rules, when such an expression appears on the left side of an assignment, it gets transformed approximately into t1.put(t2, newValue). (Actually, the assignment transform also arranges for the value of the assignment to be the value the rValue evaluated to.)

lValuePair can only be applied to NounExprs and CallExprs.


update

public EExpr update(Object lValue,
                    Object verb,
                    Object rnValue)
Enabled:

Specified by:
update in interface EBuilder

slotExpr

public EExpr slotExpr(Object eExpr)
Enabled:

Specified by:
slotExpr in interface BaseEBuilder
Overrides:
slotExpr in class BaseENodeBuilder

call

public EExpr call(Object recipientExpr,
                  Object verbPos,
                  String verb,
                  Object args)
Enabled:

Specified by:
call in interface EBuilder

send

public EExpr send(Object recipientExpr,
                  Object verbPos,
                  String verb,
                  Object args)
Enabled:

Specified by:
send in interface EBuilder

not

public EExpr not(Object x)
Enabled:

Specified by:
not in interface EBuilder

doMeta

public EExpr doMeta(Object keyword,
                    Object verb,
                    Object args)
Enabled:

Specified by:
doMeta in interface EBuilder

doMeta

public EExpr doMeta(Object keyword,
                    Object verbPos,
                    String verb,
                    Object args)
Enabled:

Specified by:
doMeta in interface EBuilder

doMetaSend

public EExpr doMetaSend(Object keyword,
                        Object verb,
                        Object args)
Enabled:

Specified by:
doMetaSend in interface EBuilder

doMetaSend

public EExpr doMetaSend(Object keyword,
                        Object verbPos,
                        String verb,
                        Object args)
Enabled:

Specified by:
doMetaSend in interface EBuilder

classExpr

public EExpr classExpr(Object doco,
                       Object classHead,
                       Object mBody)
Enabled:

Specified by:
classExpr in interface EBuilder

condAnd

public EExpr condAnd(Object left,
                     Object right)
Enabled: left && right => { if (left) { if (right) { [&nameOut, ...] } else { null } } else { null } } =~ [&nameOut, ...]

Specified by:
condAnd in interface EBuilder

condOr

public 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, ...]

Specified by:
condOr in interface EBuilder

antiCycle

private EExpr[] antiCycle(FlexMap conflicts)
Expand a left-pattern and an rValue that might cause a circularity into a sequence of expressions without this circularity, except that the place for the expression itself has a null as a placeholder.


define

public EExpr define(Object pattern,
                    Object rValue)
Enabled:

Specified by:
define in interface BaseEBuilder
Overrides:
define in class BaseENodeBuilder

atNoun

public Pattern atNoun(Object token)
Enabled: When an at-hole is '@' or '@_'

Specified by:
atNoun in interface EBuilder

finalPattern

public Pattern finalPattern(Object str)
Enabled:

Specified by:
finalPattern in interface EBuilder

varPattern

public Pattern varPattern(Object name)
Enabled:

Specified by:
varPattern in interface EBuilder

slotDefiner

public Pattern slotDefiner(Object name)
Enabled:

Specified by:
slotDefiner in interface EBuilder

dollarNoun

public EExpr dollarNoun(Object token)
Enabled: When a dollar-hole is '$'

Specified by:
dollarNoun in interface EBuilder

ident

private Astro ident(Object original,
                    String newStr)
Makes an identifier token whose value is 'newStr', and whose source is derived from 'original'.

'original' might be a String, an identifier token (an Astro), a CallExpr, or a SendExpr.


newTemp

private Astro newTemp(Object identOrString)
generate 'unique' temporary variable names for transformations. Suffix must be odd to make room for the new guests at the Hilbert Hotel.

Parameters:
identOrString - Either an Astro representing an identifier, or a String whose value is an identifier
Returns:
The variable name for use in the program.
See Also:
varName(Object), HilbertHotel.newTemp(String)

varName

public Astro varName(Object identOrStr)
Enabled: Make vacancies for new temporary variable names.

Specified by:
varName in interface EBuilder
Parameters:
identOrStr - An Astro representing the identifier as it appears in the source code.
Returns:
The variable name as far as the program is concerned. So long as identOrStr doesn't have the form of a temporary variable name, this will be the same as identOrStr.
See Also:
HilbertHotel.rename(String)

mangle

public Astro mangle(Object ident,
                    String suffix)
Enabled: Mangles an identifier into a variable name by appending a known suffix.

Specified by:
mangle in interface EBuilder
Parameters:
ident - An Astro representing the identifier as it appears in the source code.
Returns:
The resulting variable name for use in the program.

prop

public Astro prop(Object propertyName)
Enabled: Used to transform 'a.name' into 'a.getName(args)'.

'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)'

Specified by:
prop in interface EBuilder
Parameters:
propertyName - An Astro representing the identifier as it appears in the source code.
Returns:
The resulting verb for use in the program.

forward

public EExpr forward(Object identOrStr)
Enabled: A forward declaration.

"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.

Specified by:
forward in interface EBuilder

bindDefiner

public Pattern bindDefiner(Object identOrStr)
Enabled:

Specified by:
bindDefiner in interface EBuilder

bindDefiner

public Pattern bindDefiner(Object identOrStr,
                           Object valueGuardExpr)
Enabled:

Specified by:
bindDefiner in interface EBuilder

oDecl

public ObjDecl oDecl(Object optExtends,
                     Object auditors)
Enabled:

Specified by:
oDecl in interface EBuilder

oDecl

public ObjDecl oDecl(Object doco,
                     Object optOName,
                     Object oldODecl)
Enabled:

Specified by:
oDecl in interface EBuilder

delegatex

public Matcher delegatex(Object bodyExpr)
Enabled: delegate{expr} expands to match [verb, args] { E call(expr, verb, args) }

Specified by:
delegatex in interface EBuilder

ejector

public EExpr ejector(Object ejNoun)
Enabled:

Specified by:
ejector in interface EBuilder

ejector

public EExpr ejector(Object ejNoun,
                     Object valExpr)
Enabled:

Specified by:
ejector in interface EBuilder

forx

public EExpr forx(Object assoc,
                  Object collExpr,
                  Object mBody)
Enabled:

Specified by:
forx in interface EBuilder
Parameters:
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.
Returns:
The expression for computing the for-loop.

accumulate

public EExpr accumulate(Object starterExpr,
                        Object accumulator)
Enabled:

Specified by:
accumulate in interface EBuilder
Parameters:
starterExpr - The initial value to be accumulated on to.
accumulator - A pair of a temp-name and an accumExpr.
Returns:
An expression that evaluates to the accumulated value.

accumFor

public Object[] accumFor(Object assoc,
                         Object collExpr,
                         Object accumBody)
Enabled:

Specified by:
accumFor in interface EBuilder
Parameters:
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.
Returns:
A pair of a temp-name and the obvious for-loop EExpr.

accumIf

public Object[] accumIf(Object condExpr,
                        Object accumBody)
Enabled:

Specified by:
accumIf in interface EBuilder

accumWhile

public Object[] accumWhile(Object condExpr,
                           Object accumBody)
Enabled:

Specified by:
accumWhile in interface EBuilder

accumBody

public Object[] accumBody(Object verb,
                          Object rnValue)
Enabled:

Specified by:
accumBody in interface EBuilder
Parameters:
verb - The messageName that says how the temporary should be updated.
rnValue - The argument-list for computing a new value.
Returns:
A pair of a new temp-name and the expression
    temp-name verb= rnValue

ifx

public EExpr ifx(Object condExpr,
                 Object thenExpr)
Enabled:

Specified by:
ifx in interface EBuilder

lessThan

public EExpr lessThan(Object x,
                      Object y)
Enabled:

Specified by:
lessThan in interface EBuilder

leq

public EExpr leq(Object x,
                 Object y)
Enabled:

Specified by:
leq in interface EBuilder

asBigAs

public EExpr asBigAs(Object x,
                     Object y)
Enabled:

Specified by:
asBigAs in interface EBuilder

geq

public EExpr geq(Object x,
                 Object y)
Enabled:

Specified by:
geq in interface EBuilder

greaterThan

public EExpr greaterThan(Object x,
                         Object y)
Enabled:

Specified by:
greaterThan in interface EBuilder

till

public EExpr till(Object start,
                  Object bound)
Enabled:

Specified by:
till in interface EBuilder

thru

public EExpr thru(Object start,
                  Object stop)
Enabled:

Specified by:
thru in interface EBuilder

macro

public EExpr macro(Object macroName,
                   Object optMacroArg,
                   Object macroBody,
                   Object optNextMacro)
Enabled:

Specified by:
macro in interface EBuilder

map

public EExpr map(Object assocList)
Enabled: [a => b, c => d] expands to __makeMap fromPairs([[a, b], [c, d]) This exapansion satisfies the requirement that it preserves order.

Specified by:
map in interface EBuilder

mapPattern

public Pattern mapPattern(Object assocList,
                          Object optRestPatt)
Enabled:

Specified by:
mapPattern in interface EBuilder

assoc

public Assoc assoc(Object key,
                   Object value)
Enabled:

Specified by:
assoc in interface EBuilder

exporter

public Assoc exporter(Object nounExpr)
Enabled:

Specified by:
exporter in interface EBuilder

importer

public Assoc importer(Object namerPatt)
Enabled:

Specified by:
importer in interface EBuilder

mod

public EExpr mod(Object val,
                 Object nModulus)
Enabled:

Specified by:
mod in interface EBuilder

slotsPattern

private Pattern slotsPattern(Object[] names)
Given an array of names, return a tuple pattern that will bind all these names to slots when matched with an array of slots with the same shape.


slotsTuple

private EExpr slotsTuple(Object[] names)
Given an array of names, return an expression that will make a tuple from the slots of the variables of these names


to

public EMethodNode to(Object doco,
                      Object msgPatt,
                      Object bodyExpr)
Enabled:

Specified by:
to in interface EBuilder
Parameters:
doco -
msgPatt -
bodyExpr -
Returns:

methScriptDecl

private EScriptDecl methScriptDecl(Object msgPatt,
                                   Object bodyExpr,
                                   boolean bindReturn)
For defining an eScript that consists of exactly one method


thunk

public EExpr thunk(Object doco,
                   Object bodyExpr)
Enabled: Expands to
     def _() :any { bodyExpr }
 

Specified by:
thunk in interface EBuilder

methObject

public EExpr methObject(Object decl,
                        Object msgPatt,
                        Object bodyExpr,
                        boolean bindReturn)
Enabled: For defining an eScript that consists of exactly one method

Specified by:
methObject in interface EBuilder

object

public EExpr object(Object decl,
                    Object script)
Enabled:

Specified by:
object in interface EBuilder

object

private EExpr object(String docComment,
                     Object optOName,
                     EExpr optSuperExpr,
                     EExpr[] impls,
                     EScriptDecl script)
Parameters:
optOName - may be null (meaning anonymous), a String, a LiteralString/LiteralTwine (a literal string as an FQN) or a Pattern representing both the variable to be initialized and the name part of a FQN.

patternEquals

public Pattern patternEquals(Object eExpr)
Enabled: (== eExpr) expands to (specimen ? specimen == eExpr)

Specified by:
patternEquals in interface EBuilder

quasiExpr

public 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])

Specified by:
quasiExpr in interface EBuilder

quasiLiteralExpr

public QuasiLiteralExpr quasiLiteralExpr()
Enabled: $$ expands to ${0}

Specified by:
quasiLiteralExpr in interface EBuilder

quasiLiteralExpr

public QuasiLiteralExpr quasiLiteralExpr(Object litIndex)
Enabled:

Specified by:
quasiLiteralExpr in interface EBuilder

quasiLiteralPatt

public QuasiLiteralPatt quasiLiteralPatt(Object litIndex)
Enabled:

Specified by:
quasiLiteralPatt in interface EBuilder

quasiPattern

public 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])

Specified by:
quasiPattern in interface EBuilder

quasiPatternExpr

public QuasiPatternExpr quasiPatternExpr(Object litIndex)
Enabled:

Specified by:
quasiPatternExpr in interface EBuilder

quasiPatternPatt

public QuasiPatternPatt quasiPatternPatt(Object litIndex)
Enabled:

Specified by:
quasiPatternPatt in interface EBuilder

same

public EExpr same(Object x,
                  Object y)
Enabled:

Specified by:
same in interface EBuilder

sequence

public EExpr sequence(Object x,
                      Object y)
Enabled:

Specified by:
sequence in interface EBuilder

sequence

public EExpr sequence(Object x,
                      Object y,
                      Object z)
Enabled:

Specified by:
sequence in interface EBuilder

switchx

public 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) } }

Specified by:
switchx in interface EBuilder

matchExpr

private EExpr matchExpr(Matcher[] matchers,
                        Astro varName,
                        EExpr optOtherwise)

optMatcher

Matcher optMatcher(Object matchers)

tuple

public EExpr tuple(Object argList)
Enabled: [x, y, z] expands to __makeList(x, y, z)

Specified by:
tuple in interface EBuilder

uriExpr

public EExpr uriExpr(Object uriToken)
Enabled: uriToken must be a URI, and have both protocol and body.

<http:foo> expands to http__uriGetter["foo"]. <x:foo> expands to file__uriGetter["x:foo"].

Specified by:
uriExpr in interface EBuilder

uriExpr

public EExpr uriExpr(Object uriStartToken,
                     Object uriBodyExpr)
Enabled: uriStartToken must be a URIStart, and must have a protocol, but no body.

<http: expr> expands to http__uriGetter[expr] <x: expr> expands to file__uriGetter["x:" + expr]

Specified by:
uriExpr in interface EBuilder

whilex

public 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 } }) }

Specified by:
whilex in interface EBuilder

tryx

public EExpr tryx(Object eExpr,
                  Object catchers,
                  Object optFinally)
Enabled:

Specified by:
tryx in interface BaseEBuilder
Overrides:
tryx in class BaseENodeBuilder

whenBase

private EExpr whenBase(EExpr eExpr,
                       ObjDecl objDecl,
                       Pattern patt1,
                       EExpr resultGuard,
                       EExpr body1,
                       Object catchers,
                       Object optFinally)
Then when statement base-case expands as follows:
     when (eExpr) -> done(patt1) :resultGuard {
         body1
     } catch ... {
         ...
     } ... # possibly more catches & a finally clause
 
expands to
    Ref whenResolved(eExpr, def done(resolution) :resultGuard {
        try {
            if (Ref isBroken(resolution)) {
                throw(Ref optProblem(resolution))
            }
            def patt1 := resolution
            body1
        } catch ... {
            ...
        } ... # possibly more catches & a finally clause
    })
 


whenList

private EExpr whenList(EExpr[] eExprs,
                       ObjDecl objDecl,
                       Pattern[] patts,
                       EExpr resultGuard,
                       EExpr body1,
                       Object catchers,
                       Object optFinally)
Then normal when statement syntax expands as follows:
    when (eExprs,...) -> done(patts,...) :resultGuard {
        body1
    } catch patt2 {
        body2
    }
 
eExprs and patts must have the same arity, which must be >=1. If it's exactly 1, the we use the above base case. Otherwise we expand to
    when (promiseAllFulfilled([eExprs,...]) ->
                                    done([patts,...]) :resultGuard {
        body1
    } catch patt2 {
        body2
    }
 
which then expands according to the base case explained in whenBase(org.erights.e.elang.evm.EExpr, org.erights.e.elang.syntax.ObjDecl, org.erights.e.elang.evm.Pattern, org.erights.e.elang.evm.EExpr, org.erights.e.elang.evm.EExpr, java.lang.Object, java.lang.Object)


when

public EExpr when(Object headList,
                  Object bodyExpr,
                  Object catchers,
                  Object optFinally)
Enabled:

Specified by:
when in interface EBuilder

oType

public EExpr oType(Object doco,
                   Object oName,
                   Object mTypes)
Enabled:

Specified by:
oType in interface EBuilder

oType

public EExpr oType(Object doco,
                   Object optOName,
                   Object optAudit,
                   Object decl,
                   Object mTypes)
Enabled:

Specified by:
oType in interface EBuilder

oType

private EExpr oType(LiteralExpr docComment,
                    Object optOName,
                    Pattern optAuditorPatt,
                    EExpr optExtends,
                    EExpr auditorTuple,
                    EExpr msgTuple)

oTypeBase

private EExpr oTypeBase(LiteralExpr docComment,
                        Pattern optGuardPatt,
                        Pattern optAuditorPatt,
                        EExpr qualName,
                        EExpr auditorTuple,
                        EExpr msgTuple)

mType

public EExpr mType(Object doco,
                   Object verb,
                   Object pTypes,
                   Object optRetType)
Enabled:

Specified by:
mType in interface EBuilder

pType

public EExpr pType(Object optName,
                   Object optType)
Enabled:

Specified by:
pType in interface EBuilder


comments?