[e-lang] Proposed Kernel-E abstract syntax
Kevin Reid
kpreid at mac.com
Fri Jun 23 11:11:29 EDT 2006
On Jun 9, 2006, at 20:23, Mark Miller wrote:
> Proposed Kernel-E grammar and schema. Please view in a fixed width
> font.
> ...
> <e> ::=
> quote(.char. | .int. | .float64. | .String.)
> # String | Char | Integer |
> Float64
> | call(<e>,<verb>,[<e>*]) # e.verb(<e>**,)
> | seq(<e>,<e>) # e1; e2
In case this is interesting, here is an automatically generated
description of Kernel-E as E-on-CL implements it.
The parameter layouts are those accepted by the node makers; the
parameter names are the same as the getter messages.
Bugs:
- The source-hole node classes are listed, even though they aren't
truly kernel.
- The abstract node classes are listed.
- The guards are printed oddly due to imperfect E/Lisp bridging;
"int[0]" actually means "(int >= 0)".
I plan to fix these bugs, but it's already taken a while to create
the ability to generate this list, so I'm reporting this work-in-
progress.
The script:
pragma.enable("easy-return")
pragma.disable("explicit-result-guard")
def dke(evaluator, out) {
for name => maker in evaluator.getKernelNodes() {
out.print(name)
def arity := maker.getParameterSubnodeFlags().size()
maker.__getAllegedType() \
.getMessageTypes() \
[`run/${arity + 2}`] \
.getParams() \
.run(1, arity + 1) \
.printOn("(", ", ", ")", out)
out.println()
}
}
dke(__eval, stdout)
The nodes:
AssignExpr(noun :EExpr, rValue :EExpr)
CallExpr(recipient :EExpr, verb :String, args :e-list[EExpr])
CatchExpr(attempt :EExpr, pattern :Pattern, catcher :EExpr)
CdrPattern(listPatt :ListPattern, restPatt :Pattern)
DefineExpr(pattern :Pattern, rValue :EExpr, optEjectorExpr :any[Null,
EExpr])
EExpr()
EMatcher(pattern :Pattern, body :EExpr)
EMethod(docComment :String, verb :String, patterns :e-list[Pattern],
optResultGuard :any[Null, EExpr], body :EExpr)
EScript(optMethods :any[Null, e-list[EMethodoid]], matchers :e-list
[EMatcher])
EscapeExpr(ejectorPattern :Pattern, body :EExpr, optCatchPattern :any
[Null, Pattern], optCatchBody :any[Null, EExpr])
FinalPattern(noun :EExpr, optGuardExpr :any[Null, EExpr])
FinallyExpr(attempt :EExpr, unwinder :EExpr)
HideExpr(block :EExpr)
IfExpr(test :EExpr, then :EExpr, ::"else" :EExpr)
IgnorePattern()
IntoExpr(rValue :EExpr, optEjectorExpr :any[Null, EExpr],
pattern :Pattern)
ListPattern(subs :e-list[Pattern])
LiteralExpr(value :any[String, char, rational, float64])
MetaContextExpr()
MetaStateExpr()
NounExpr(name :String)
NounPattern()
ObjectExpr(docComment :String, qualifiedName :String, auditorExprs :e-
list[EExpr], script :escriptoid)
Pattern()
QuasiLiteralExpr(index :int[0])
QuasiLiteralNode(index :int[0])
QuasiLiteralPatt(index :int[0])
QuasiNode()
QuasiPatternExpr(index :int[0])
QuasiPatternNode(index :int[0])
QuasiPatternPatt(index :int[0])
SeqExpr(subs :e-list[EExpr])
SlotExpr(noun :EExpr)
SlotPattern(noun :EExpr, optGuardExpr :any[Null, EExpr])
VarPattern(noun :EExpr, optGuardExpr :any[Null, EExpr])
ViaPattern(::"function" :EExpr, pattern :Pattern)
--
Kevin Reid <http://homepage.mac.com/kpreid/>
More information about the e-lang
mailing list