root/trunk/ProjectFortress/astgen/Fortress.ast

Revision 2935, 91.9 kB (checked in by sukyoungryu, 4 hours ago)

[AST] Deleted obsolete nodes: AbsExternalSyntax? and ExternalSyntax?

Line 
1 /*******************************************************************************
2     Copyright 2008 Sun Microsystems, Inc.,
3     4150 Network Circle, Santa Clara, California 95054, U.S.A.
4     All rights reserved.
5
6     U.S. Government Rights - Commercial software.
7     Government users are subject to the Sun Microsystems, Inc. standard
8     license agreement and applicable provisions of the FAR and its supplements.
9
10     Use is subject to license terms.
11
12     This distribution may include materials developed by third parties.
13
14     Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
15     trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
16  ******************************************************************************/
17
18 // REMINDER: If you modify this file, you probably ought to be
19 // changing ExprFactory.makeInParentheses as well.
20
21 // Please do not name any nodes all capital letters. This file is used to autogenerate
22 // Library/FortressAst.fsi and fortress traits cannot have all capital letters.
23
24 generateEmptyConstructor yes;   // for reflective object creation
25 visitMethod accept;
26 visitorMethodPrefix for;
27 addGetterPrefixes yes;
28 usePLT yes;
29 tabSize 4;
30 allowNulls no;
31 generateToString no;
32 generateEquals yes;
33 generateSerializers yes;
34 generateRecursiveVisitors no;
35 customClassPath ../build;
36
37 /* order matters here */
38 customGenerator com.sun.fortress.astgen.DepthFirstVisitorGenerator;
39 customGenerator com.sun.fortress.astgen.TemplateDepthFirstVisitorGenerator;
40
41 customGenerator com.sun.fortress.astgen.DepthFirstVoidVisitorGenerator;
42 customGenerator com.sun.fortress.astgen.TemplateDepthFirstVoidVisitorGenerator;
43
44
45 customPreprocessor com.sun.fortress.astgen.TransformationNodeCreator;
46 customPreprocessor com.sun.fortress.astgen.EllipsesNodeCreator;
47 customPreprocessor com.sun.fortress.astgen.TemplateGapNodeCreator;
48 customGenerator com.sun.fortress.astgen.UpdateVisitorGenerator;
49 customGenerator com.sun.fortress.astgen.TemplateVisitorGenerator;
50
51 customGenerator com.sun.fortress.astgen.SingleSpanConstructorGenerator;
52
53 customGenerator com.sun.fortress.astgen.FortressAstGenerator;
54
55 package com.sun.fortress.nodes;
56 import java.math.BigInteger;
57 import java.util.Collections;
58 import java.util.List;
59 import java.util.ArrayList;
60 import java.util.LinkedList;
61 import java.util.Set;
62 import com.sun.fortress.nodes_util.*;
63 import com.sun.fortress.parser_util.*;
64 import com.sun.fortress.parser_util.precedence_opexpr.*;
65 import com.sun.fortress.useful.*;
66 import edu.rice.cs.plt.tuple.Option;
67
68 begin ast;
69
70 /**
71  * top-level node interface
72  */
73 interface Node(ignoreForEquals Span span = new Span()) extends HasAt;
74     /**
75      * declaration in components or APIs
76      */
77     interface AbsDeclOrDecl();
78         /**
79          * declaration in APIs
80          */
81         interface AbsDecl();
82         /**
83          * declaration in components
84          */
85         interface Decl();
86     /**
87      * left-hand-side of assignments, local variable declarations, or
88      * top-level variable declarations
89      */
90     interface Lhs();
91     /**
92      * getter or setter declarations
93      */
94     interface ImplicitGetterSetter(Id name,
95                                    List<Modifier> mods = Collections.<Modifier>emptyList(),
96                                    Option<Type> type = Option.<Type>none());
97     /**
98      * with static parameters
99      * implemented by trait, object, and function declarations and
100      * object expressions in components or APIs
101      */
102     interface Generic(List<StaticParam> staticParams);
103     /**
104      * with value parameters
105      * implemented by object declarations and object expressions in components
106      * or APIs
107      */
108     interface HasParams(Option<List<Param>> params,
109                         List<? extends AbsDeclOrDecl> decls);
110     /**
111      * with a where clause
112      * implemented by trait and object declarations in components or APIs
113      */
114     interface HasWhere(Option<WhereClause> where);
115     /**
116      * templates
117      */
118     interface TemplateGap(Id gapId, List<Id> templateParams);
119
120     /**
121      * A syntax transformation
122      */
123     interface _SyntaxTransformation(String syntaxTransformer,
124                                     java.util.Map<String,Level> variables,
125                                     java.util.List<String> syntaxParameters);
126
127     /**
128      * Repeated expression inside a syntax transformation template
129      */
130     interface _Ellipses(AbstractNode repeatedNode);
131
132     /**
133      * intersections of interface types
134      */
135     interface GenericWithParams() extends Generic, HasParams;
136     interface GenericAbsDeclOrDecl() extends Generic, AbsDeclOrDecl;
137         interface GenericDecl() extends Decl;
138     interface GenericAbsDeclOrDeclWithParams() extends GenericWithParams,
139                                                        GenericAbsDeclOrDecl;
140         interface GenericDeclWithParams() extends GenericDecl;
141
142     /**
143      * type or the domain of an arrow type
144      */
145     interface TypeOrDomain();
146
147     /**
148      * top-level node abstract class
149      */
150     abstract AbstractNode() extends UIDObject;
151
152
153         /**
154          * compilation unit declaration
155          * CompilationUnit ::= Component | Api
156          */
157         abstract CompilationUnit(APIName name, List<Import> imports);
158
159
160             /**
161              * component declaration
162              * Component ::= native? component APIName Imports? Exports Decls? end
163              * e.g.) component Hello
164              *         export Executable
165              *         run(args:String...) = print "Hello, World!\n"
166              *       end
167              */
168             Component(boolean _native = false, APIName name, List<Import> imports,
169                       List<Export> exports, List<Decl> decls,
170                       List<_RewriteObjectExpr> objectExprs =
171                            Collections.<_RewriteObjectExpr>emptyList(),
172                       List<String> functionalMethodNames =
173                            Collections.<String>emptyList());
174             /* the list of object expressions is a temporary hack to allow
175                progress towards earlier rewriting and caching of ASTs. -- DRC */
176             /**
177              * API declaration
178              * Api ::= api APIName Imports? AbsDecls? end
179              * e.g.) api Executable
180              *         run(args:String...):()
181              *       end
182              */
183             Api(List<AbsDecl> decls);
184         /**
185          * import statement
186          * Import ::= import ImportedNames | import api AliasedAPINames
187          */
188         abstract Import();
189             /**
190              * ImportedNames ::= APIName . {...} (except SimpleNames)?
191              *                 | APIName . { AliasedSimpleNameList (, ...)? }
192              *                 | QualifiedName (as Id)?
193              */
194             abstract ImportedNames(APIName api);
195                 /**
196                  * Names must be unqualified.
197                  * e.g.) import Set.{...} except {opr UNION, union}
198                  */
199                 ImportStar(List<IdOrOpOrAnonymousName> except);
200                 /**
201                  * e.g.) import Set.{empty, union}
202                  */
203                 ImportNames(List<AliasedSimpleName> aliasedNames);
204             /**
205              * e.g.) import api {Set, Map, List}
206              */
207             ImportApi(List<AliasedAPIName> apis);
208         /**
209          * aliased simple name used in import statements
210          * AliasedSimpleName ::= Id (as Id)?
211          *                     | opr Op (as Op)?
212          *                     | opr EncloserPair (as EncloserPair)?
213          * EncloserPair ::= (LeftEncloser | Encloser) (RightEncloser | Encloser)
214          * e.g.) longComplexName as shortName
215          * Names and aliases must be unqualified.
216          */
217         AliasedSimpleName(IdOrOpOrAnonymousName name,
218                           Option<IdOrOpOrAnonymousName> alias = Option.<IdOrOpOrAnonymousName>none());
219         /**
220          * aliased API name used in import statements
221          * AliasedAPIName ::= APIName (as Id)?
222          * e.g.) com.sun.fortress.parser.precedence.resolver as precedence_resolver
223          * Alias must be unqualified.
224          */
225         AliasedAPIName(APIName api,
226                        Option<Id> alias = Option.<Id>none());
227         /**
228          * export statement
229          * Export ::= export APINames
230          * e.g.) export Executable
231          */
232         Export(List<APIName> apis);
233         /**
234          * trait or object declaration in components or APIs
235          * Name must be unqualified.
236          */
237         abstract TraitObjectAbsDeclOrDecl(List<Modifier> mods
238                                               = Collections.<Modifier>emptyList(),
239                                           Id name,
240                                           List<StaticParam> staticParams
241                                               = Collections.<StaticParam>emptyList(),
242                                           List<TraitTypeWhere> extendsClause
243                                               = Collections.<TraitTypeWhere>emptyList(),
244                                           Option<WhereClause> where
245                                               = Option.<WhereClause>none(),
246                                           List<? extends AbsDeclOrDecl> decls)
247                                          implements HasWhere, GenericAbsDeclOrDecl;
248             /**
249              * trait declaration in components or APIs
250              */
251             abstract TraitAbsDeclOrDecl(List<BaseType> excludes
252                                             = Collections.<BaseType>emptyList(),
253                                         Option<List<BaseType>> comprises
254                                             = Option.<List<BaseType>>none(),
255                                         List<? extends AbsDeclOrDecl> decls);
256                 /**
257                  * trait declaration in APIs
258                  * AbsTraitDecl ::= AbsTraitMods? TraitHeaderFront AbsTraitClauses
259                  *                  AbsGoInATrait? end
260                  * TraitHeaderFront ::= trait Id StaticParams? ExtendsWhere?
261                  * ExtendsWhere ::= extends TraitTypeWheres
262                  * AbsTraitClause ::= Excludes | AbsComprises | Where
263                  * Excludes ::= excludes TraitTypes
264                  * AbsComprises ::= comprises ComprisingTypes
265                  * ComprisingTypes ::= TraitType | { ComprisingTypeList }
266                  * ComprisingTypeList ::= ...
267                  *                      | TraitType(, TraitType)*(, ...)?
268                  * AbsGoInATrait ::= AbsCoercions? AbsGoFrontInATrait AbsGoBackInATrait?
269                  *                 | AbsCoercions? AbsGoBackInATrait
270                  *                 | AbsCoercions
271                  * AbsGoesFrontInATrait ::= ApiFldDecl
272                  *                        | AbsGetterSetterDecl
273                  *                        | PropertyDecl
274                  * AbsGoesBackInATrait  ::= AbsMdDecl
275                  *                        | PropertyDecl
276                  * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]}
277                  *         cons(x: alph): List[\alpha\]
278                  *       end
279                  */
280                 AbsTraitDecl(List<AbsDecl> decls) implements AbsDecl;
281                 /**
282                  * trait declaration in components
283                  * TraitDecl ::= TraitMods? TraitHeaderFront TraitClauses GoInATrait?
284                  *               end
285                  * TraitClause ::= Excludes | Comprises | Where
286                  * Comprises ::= comprises TraitTypes
287                  * GoInATrait ::= Coercions? GoFrontInATrait GoBackInATrait?
288                  *              | Coercions? GoBackInATrait
289                  *              | Coercions
290                  * GoesFrontInATrait ::= AbsFldDecl
291                  *                     | GetterSetterDecl
292                  *                     | PropertyDecl
293                  * GoesBackInATrait  ::= MdDecl
294                  *                     | PropertyDecl
295                  * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]}
296                  *         cons(x: alph): List[\alpha\] = Cons[\alph\](x, self)
297                  *       end
298                  */
299                 TraitDecl(List<Decl> decls) implements GenericDecl;
300             /**
301              * object declaration in components or APIs
302              */
303             abstract ObjectAbsDeclOrDecl(Option<List<Param>> params
304                                              = Option.<List<Param>>none(),
305                                          Option<List<BaseType>> throwsClause
306                                              = Option.<List<BaseType>>none(),
307                                          Option<Contract> contract
308                                              = Option.<Contract>none(),
309                                          List<? extends AbsDeclOrDecl> decls)
310                                         implements GenericAbsDeclOrDeclWithParams;
311                 /**
312                  * object declaration in APIs
313                  * AbsObjectDecl ::= AbsObjectMods? ObjectHeader AbsGoInAnObject? end
314                  * ObjectHeader ::= object Id StaticParams? ObjectValParam?
315                  *                  ExtendsWhere? FnClauses
316                  * FnClauses ::= Throws? Where? Contract
317                  * Throws ::= throws MayTraitTypes
318                  * ObjectValParam ::= ( ObjectParams? )
319                  * ObjectParams ::= (ObjectParam ,)* ObjectKeyword(, ObjectKeyword)*
320                  *                | ObjectParam (, ObjectParam)*
321                  * ObjectKeyword ::= ObjectParam = Expr
322                  * ObjectParam ::= ParamFldMods? Param
323                  *               | var Param
324                  * AbsGoInAnObject ::= AbsCoercions? AbsGoFrontInAnObject AbsGoBackInAnObject?
325                  *                   | AbsCoercions? AbsGoBackInAnObject
326                  *                   | AbsCoercions
327                  * AbsGoesFrontInAnObject ::= ApiFldDecl
328                  *                          | AbsGetterSetterDecl
329                  *                          | PropertyDecl
330                  * AbsGoesBackInAnObject ::= AbsMdDecl
331                  *                         | PropertyDecl
332                  * e.g.) object Empty[\alph\]() extends List[\alpha\] end
333                  */
334                 AbsObjectDecl(List<AbsDecl> decls) implements AbsDecl;
335                 /**
336                  * object declaration in components
337                  * ObjectDecl ::= ObjectMods? ObjectHeader GoInAnObject? end
338                  * GoInAnObject ::= Coercions? GoFrontInAnObject GoBackInAnObject?
339                  *                | Coercions? GoBackInAnObject
340                  *                | Coercions
341                  * GoesFrontInAnObject ::= FldDecl
342                  *                       | GetterSetterDecl
343                  *                       | PropertyDecl
344                  * GoesBackInAnObject ::= MdDef
345                  *                      | PropertyDecl
346                  * e.g.) object Empty[\alph\]() extends List[\alpha\]
347                  *         length() = 0
348                  *       end
349                  */
350                 ObjectDecl(List<Decl> decls)
351                           implements GenericDeclWithParams;
352         /**
353          * variable declaration in components or APIs
354          */
355         abstract VarAbsDeclOrDecl(List<LValueBind> lhs) implements AbsDeclOrDecl;
356             /**
357              * variable declaration in APIs
358              * AbsVarDecl ::= AbsVarMods? VarWTypes
359              *              | AbsVarMods? BindIdOrBindIdTuple : Type ...
360              *              | AbsVarMods? BindIdOrBindIdTuple : SimpleTupleType
361              * VarWTypes ::= VarWType | ( VarWType(, VarWType)+ )
362              * VarWType ::= BindId IsType
363              * BindIdOrBindIdTuple ::= BindId
364              *                       | ( BindId , BindIdList )
365              * BindId ::= Id | _
366              * e.g.) var (x, y): ZZ64...
367              */
368             AbsVarDecl() implements AbsDecl, Decl;
369             /**
370              * variable declaration in components
371              * VarDecl ::= VarMods? VarWTypes InitVal
372              *           | VarMods? BindIdOrBindIdTuple = Expr
373              *           | VarMods? BindIdOrBindIdTuple : Type ... InitVal
374              *           | VarMods? BindIdOrBindIdTuple : SimpleTupleType InitVal
375              * InitVal ::= (= | :=) Expr
376              * e.g.) var (x, y): ZZ64... = (5, 6)
377              */
378             VarDecl(Expr init) implements Decl;
379         /**
380          * left-hand side of variable declaration
381          */
382         abstract LValue();
383             /**
384              * e.g.) var x: ZZ32
385              * Name must be unqualified.
386              */
387             LValueBind(Id name, Option<Type> type = Option.<Type>none(),
388                        List<Modifier> mods = Collections.<Modifier>emptyList(),
389                        boolean mutable = false) implements Lhs, ImplicitGetterSetter;
390             /**
391              * left-hand side of matrix unpasting
392              * Unpasting ::= [ UnpastingElems ]
393              */
394             abstract Unpasting();
395                 /**
396                  * simple unpasting
397                  * Names must be unqualified.
398                  * UnpastingElem ::= BindId ([ UnpastingDim ])?
399                  *                 | Unpasting
400                  * UnpastingDim ::= ExtentRange (BY ExtentRange)+
401                  * e.g.) squareShape[m BY m]
402                  */
403                 UnpastingBind(Id name, List<ExtentRange> dim);
404                 /**
405                  * complex unpasting
406                  * UnpastingElems ::= UnpastingElem RectSeparator UnpastingElems
407                  *                  | UnpastingElem
408                  * e.g.) squareShape[m BY m]  rest
409                  */
410                 UnpastingSplit(List<Unpasting> elems, int dim);
411         /**
412          * Overloading specification
413          */
414         _RewriteFnOverloadDecl(IdOrOpName name,
415                                List<IdOrOpName> fns) implements Decl;
416         /**
417          * functional declaration in components or APIs
418          * Names must be unqualified.
419          */
420         abstract FnAbsDeclOrDecl(List<Modifier> mods
421                                      = Collections.<Modifier>emptyList(),
422                                  IdOrOpOrAnonymousName name,
423                                  List<StaticParam> staticParams
424                                      = Collections.<StaticParam>emptyList(),
425                                  List<Param> params
426                                      = Collections.<Param>emptyList(),
427                                  Option<Type> returnType
428                                      = Option.<Type>none(),
429                                  Option<List<BaseType>> throwsClause
430                                      = Option.<List<BaseType>>none(),
431                                  Option<WhereClause> where
432                                      = Option.<WhereClause>none(),
433                                  Option<Contract> contract
434                                      = Option.<Contract>none(),
435                                  String selfName = NodeUtil.defaultSelfName)
436                                 implements Applicable, GenericDecl;
437             /**
438              * functional declaration in components or APIs
439              * AbsFnDecl ::= AbsFnMods? FnHeaderFront FnHeaderClause
440              *             | FnSig
441              * FnSig ::= SimpleName : ArrowType
442              * FnHeaderFront ::= NamedFnHeaderFront
443              *                 | OpHeaderFront
444              * NamedFnHeaderFront ::= Id StaticParams? ValParam
445              * OpHeaderFront ::= opr StaticParams? BIG? (LeftEncloser | Encloser)
446              *                     Params (RightEncloser | Encloser)
447              *                 | opr StaticParams? ValParam (Op | ExponentOp)
448              *                 | opr BIG? (Op | ^ | Encloser) StaticParams? ValParam
449              * FnHeaderClause ::= IsType? FnClauses
450              * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause
451              *          | FnSig
452              * e.g.) swap (x: Object, y: Object): (Object, Object)
453              */
454             AbsFnDecl() implements AbsDecl;
455             /**
456              * functional declaration in components
457              */
458             abstract FnDecl();
459                 /**
460                  * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr
461                  * e.g.) swap (x, y) = (y, x)
462                  */
463                 FnDef(Expr body);
464         /**
465          * value parameter of functional declarations and object declarations
466          * Names must be unqualified.
467          */
468         abstract Param(List<Modifier> mods = Collections.<Modifier>emptyList(),
469                        Id name);
470             /**
471              * ValParam := BindId
472              *           | ( Params? )
473              * Params ::= (Param, )* (Varargs, )? Keyword(, Keyword)*
474              *          | (Param, )* Varargs
475              *          | Param(, Param)*
476              * Keyword ::= Param = Expr
477              * Param ::= BindId IsType?
478              *         | Type
479              * e.g.) x: ZZ32 = 3
480              * e.g.) self
481              */
482             NormalParam(Option<Type> type = Option.<Type>none(),
483                         Option<Expr> defaultExpr = Option.<Expr>none())
484                        implements Lhs, ImplicitGetterSetter;
485             /**
486              * varargs parameter
487              * Varargs ::= BindId : Type ...
488              * e.g.) x: String...
489              */
490             VarargsParam(Type type);
491         /**
492          * dimension and unit declaration
493          * DimUnitDecl may represent a single dimension declaration, a single
494          * unit declaration, or both dimension and unit declarations.
495          * DimUnitDecl ::= dim Id (= Type)? (unit | SI_unit) Id+ (= Expr)?
496          *               | dim Id (= Type)? (default Id)?
497          *               | (unit | SI_unit) Id+ (: Type)? (= Expr)?
498          */
499         abstract DimUnitDecl() implements Decl, AbsDecl;
500             /**
501              * dimension declaration
502              * Names for dim and default must be unqualified.
503              * e.g.) dim Length SI_unit meter meters m
504              */
505             DimDecl(Id dim, Option<Type> derived = Option.<Type>none(),
506                     Option<Id> default = Option.<Id>none());
507             /**
508              * unit declaration
509              * Names of units must be unqualified.
510              * e.g.) unit inch inches: Length
511              */
512             UnitDecl(boolean si_unit = false,
513                      List<Id> units = Collections.<Id>emptyList(),
514                      Option<Type> dim = Option.<Type>none(),
515                      Option<Expr> def);
516         /**
517          * test declaration
518          * Names must be unqualified.
519          * TestDecl ::= test Id [ GeneratorClauseList ] = Expr
520          * e.g.) test fxLessThanFy[x <- E, y <- F] = assert(f(x) < f(y))
521          */
522         TestDecl(Id name, List<GeneratorClause> gens, Expr expr)
523                 implements Decl, AbsDecl;
524         /**
525          * property declaration
526          * Names must be unqualified.
527          * PropertyDecl ::= property (Id = )? (FORALL ValParam)? Expr
528          * e.g.) property fIsMonotonic = FORALL (x:ZZ, y:ZZ) (x < y) -> (f(x) < f(y))
529          */
530         PropertyDecl(Option<Id> name = Option.<Id>none(), List<Param> params,
531                      Expr expr) implements Decl, AbsDecl;
532         /**
533          * grammar declaration
534          * Names (but not extends elements) must be unqualified.
535          */
536         abstract GrammarDecl(Id name, List<Id> extends) implements AbsDecl;
537             /**
538              * grammar definition
539              */
540             GrammarDef(List<GrammarMemberDecl> members, List<TransformerDecl> transformers,
541                        boolean native);
542         /**
543          * grammar member (nonterminal or terminal) declaration
544          * Names and params must be unqualified.
545          */
546         abstract GrammarMemberDecl(Id name) implements AbsDecl;
547             /**
548              * nonterminal declaration
549              */
550             abstract NonterminalDecl(List<SyntaxDecl> syntaxDecls);
551                 /**
552                  * nonterminal definition in nonterminal declarations
553                  */
554                 NonterminalDef(NonterminalHeader header, Option<BaseType> astType);
555                 /**
556                  * nonterminal extending definition in nonterminal declarations
557                  */
558                 NonterminalExtensionDef();
559         /**
560          * nonterminal header
561          */
562         NonterminalHeader(Option<ModifierPrivate> modifier
563                             = Option.<ModifierPrivate>none(),
564                           Id name,
565                           List<NonterminalParameter> params,
566                           List<StaticParam> staticParams
567                             = Collections.<StaticParam>emptyList(),
568                           Option<Type> type,
569                           Option<WhereClause> whereClause
570                             = Option.<WhereClause>none());
571
572         /**
573          * nonterminal parameter
574          */
575         NonterminalParameter(Id name, BaseType type);
576
577         /**
578          * syntax declaration
579          */
580         abstract SyntaxDecl(Option<String> modifier) implements AbsDecl;
581             /**
582              * syntax definition in syntax declarations
583              */
584             SyntaxDef(List<SyntaxSymbol> syntaxSymbols,
585                       TransformerDecl transformer);
586
587             SuperSyntaxDef(Id nonterminal, Id grammar);
588
589         /**
590           * Transformation declaration
591           */
592         abstract TransformerDecl() implements AbsDecl;
593             /**
594              * pre transformer definition in transformer declarations
595              */
596             PreTransformerDef(Transformer transformer);
597             /**
598              * transformer definition in transformer declarations
599              */
600             NamedTransformerDef(String name, List<NonterminalParameter> parameters, Transformer transformer);
601
602         /**
603          * Transformers
604          */
605         abstract Transformer();
606             /**
607              * Unparsed template
608              */
609             UnparsedTransformer(String transformer, Id nonterminal);
610             /**
611              * Parsed template
612              */
613             NodeTransformer(AbstractNode node);
614             /**
615              * Case-dispatch transformer expr
616              */
617             CaseTransformer(Id gapName, List<CaseTransformerClause> clauses);
618
619         /**
620          * Case transformer clause
621          */
622         CaseTransformerClause(Id constructor, List<Id> parameters, Transformer body);
623
624         /**
625           * syntax symbol
626           */
627         abstract SyntaxSymbol();
628             /**
629              * prefixed syntax symbol
630              */
631             PrefixedSymbol(Id id, SyntaxSymbol symbol);
632             /**
633              * optional syntax symbol
634              */
635             OptionalSymbol(SyntaxSymbol symbol);
636             /**
637              * repeat zero-or-more syntax symbol
638              */
639             RepeatSymbol(SyntaxSymbol symbol);
640             /**
641              * repeat one-or-more syntax symbol
642              */
643             RepeatOneOrMoreSymbol(SyntaxSymbol symbol);
644             /**
645              * ignore following whitespace syntax symbol
646              */
647             NoWhitespaceSymbol(SyntaxSymbol symbol);
648             /**
649              * groups of symbols
650              */
651             GroupSymbol(List<SyntaxSymbol> symbols);
652             /**
653              * special symbols syntax symbol
654              */
655             abstract SpecialSymbol();
656                 /**
657                  * any character syntax symbol
658                  */
659                 AnyCharacterSymbol();
660                 /**
661                  * whitespace syntax symbol
662                  */
663                 WhitespaceSymbol(String s);
664                 /**
665                  * tab syntax symbol
666                  */
667                 TabSymbol();
668                 /**
669                  * formfeed syntax symbol
670                  */
671                 FormfeedSymbol();
672                 /**
673                  * carriage return syntax symbol
674                  */
675                 CarriageReturnSymbol();
676                 /**
677                  * backspace syntax symbol
678                  */
679                 BackspaceSymbol();
680                 /**
681                  * newline syntax symbol
682                  */
683                 NewlineSymbol();
684                 /**
685                  * breakline syntax symbol
686                  */
687                 BreaklineSymbol(String s);
688             /**
689              * item syntax symbol;
690              * may be either nonterminal or keyword
691              */
692             ItemSymbol(String item);
693             /**
694              * non-terminal syntax symbol
695              */
696             NonterminalSymbol(Id nonterminal);
697             /**
698              * keyword syntax symbol
699              */
700             KeywordSymbol(String token);
701             /**
702              * token syntax symbol
703              */
704             TokenSymbol(String token);
705             /**
706              * not predicate syntax symbol
707              */
708             NotPredicateSymbol(SyntaxSymbol symbol);
709             /**
710              * and predicate syntax symbol
711              */
712             AndPredicateSymbol(SyntaxSymbol symbol);
713             /**
714              * character class syntax symbol
715              */
716             CharacterClassSymbol(List<CharacterSymbol> characters);
717             /**
718              * character symbols
719              */
720             abstract CharacterSymbol();
721                 /**
722                  * character
723                  */
724                 CharSymbol(String string);
725                 /**
726                  * character interval
727                  */
728                 CharacterInterval(String begin, String end);
729         /**
730          * expression
731          */
732         root abstract Expr(ignoreForEquals boolean parenthesized = false,
733                            ignoreForEquals Option<Type> exprType = Option.<Type>none());
734
735             /**
736              * expression annotated with a type
737              */
738             abstract TypeAnnotatedExpr(Expr expr, Type type);
739                 /**
740                  * type ascription expression
741                  * Expr ::= Expr as Type
742                  * e.g.) 3 as Number
743                  */
744                 AsExpr();
745                 /**
746                  * type assumption expression
747                  * Expr ::= Expr asif Type
748                  * e.g.) Empty asif List[\String\]
749                  */
750                 AsIfExpr();
751             /**
752              * assignment expression
753              * AssignExpr ::= AssignLefts AssignOp Expr
754              * AssignLefts ::= ( AssignLeft(, AssignLeft)* )
755              *               | AssignLeft
756              * AssignLeft ::= SubscriptExpr
757              *              | FieldSelection
758              *              | QualifiedName
759              * FieldSelection ::= Primary . Id
760              * AssignOp ::= := | Op=
761              * e.g.) x += 1
762              */
763             Assignment(List<Lhs> lhs, Option<OpRef> opr, Expr rhs);
764                 /**
765                  * An assignment that has passed typechecking, and uses an operator.
766                  * Because different static args can be inferred for each Lhs assignment
767                  * opr, this node gives a separate OpRef for each Lhs.
768                  */
769                 _RewriteAssignment(List<OpRef> opsForLhs);
770             /**
771              * expressions beginning and ending with reserved words
772              * Expr ::= DelimitedExpr
773              */
774             abstract DelimitedExpr();
775                 /**
776                  * sequence of block elements implicitly enclosed by do/end
777                  * BlockElems ::= BlockElem+
778                  * e.g.) y = x
779                  *       z = 2x
780                  *       y + z
781                  */
782                 Block(List<Expr> exprs);
783                 /**
784                  * case expression or extremum expression
785                  * DelimitedExpr ::= case Expr Op? of CaseClauses CaseElse? end
786                  *                 | case most Op of CaseClauses end
787                  * CaseElse ::= else => BlockElems
788                  * e.g.) case most > of
789                  *         1 mile => "miles are larger"
790                  *         1 kilometer => "we were wrong again"
791                  *       end
792                  *  eqOp and inOp are to help with disambiguation
793                  */
794                 CaseExpr(Option<Expr> param,
795                          Option<OpRef> compare = Option.<OpRef>none(),
796                          OpRef equalsOp = ExprFactory.makeInfixEq(),
797                          OpRef inOp= ExprFactory.makeInfixIn(),
798                          List<CaseClause> clauses,
799                          Option<Block> elseClause = Option.<Block>none());
800                 /**
801                  * do expression
802                  * Do ::= (DoFront also)* DoFront end
803                  * e.g.) do
804                  *         accum += treeSum(t.left)
805                  *       also do
806                  *         accum += treeSum(t.right)
807                  *       also do
808                  *         accum += t.datum
809                  *       end
810                  */
811                 Do(List<DoFront> fronts);
812                 /**
813                  * for expression
814                  * DelimitedExpr ::= for GeneratorClauseList DoFront end
815                  * e.g.) for i <- sequential(1:5) do
816                  *         print (i " ")
817                  *       end
818                  */
819                 For(List<GeneratorClause> gens, DoFront body);
820                 /**
821                  * if expression
822                  * DelimitedExpr ::= if CondExpr then BlockElems Elifs? Else? end
823                  *                 | ( if CondExpr then BlockElems Elifs? Else end? )
824                  * Elif ::= elif CondExpr then BlockElems
825                  * Else ::= else BlockElems
826                  * CondExpr ::= BindId <- Expr
827                  *            | Expr
828                  * e.g.) if x IN {0, 1, 2} then 0
829                  *       elif x IN {3, 4, 5} then 3
830                  *       else 6 end
831                  */
832                 If(List<IfClause> clauses,
833                    Option<Block> elseClause = Option.<Block>none());
834                 /**
835                  * label expression
836                  * Names must be unqualified.
837                  * DelimitedExpr ::= label Id BlockElems end Id
838                  * e.g.) label I_95
839                  *         if goingTo(Sun)
840                  *         then exit I_95 with x32B
841                  *         else x32A
842                  *         end
843                  *       end I_95
844                  */
845                 Label(Id name, Block body);
846                 /**
847                  * object expression
848                  */
849                 abstract AbstractObjectExpr(List<TraitTypeWhere> extendsClause
850                                                 = Collections.<TraitTypeWhere>emptyList(),
851                                             List<Decl> decls);
852                     /**
853                      * object expression
854                      * DelimitedExpr ::= object ExtendsWhere? GoInAnObject? end
855                      * e.g.)  object extends {List}
856                      *          cons(x) = Cons(x, self)
857                      *          append (xs) = xs
858                      *        end
859                      */
860                     ObjectExpr();
861                     /**
862                      * object expression rewritten by interpreter.rewrite.Disambiguate
863                      */
864                     _RewriteObjectExpr(BATree<String, StaticParam> implicitTypeParameters,
865                                        String genSymName,
866                                        List<StaticParam> staticParams,
867                                        List<StaticArg> staticArgs,
868                                        Option<List<Param>> params)
869                                       implements GenericWithParams;
870                 /**
871                  * try expression
872                  * DelimitedExpr ::= try BlockElems Catch? (forbid TraitTypes)?
873                  *                     (finally BlockElems)? end
874                  * e.g.) try
875                  *         inp = read (file)
876                  *         write (inp, newFile)
877                  *       forbid IOException
878                  *       end
879                  */
880                 Try(Block body, Option<Catch> catchClause = Option.<Catch>none(),