root/trunk/ProjectFortress/astgen/Fortress.ast @ 2229

Revision 2229, 90.0 KB (checked in by dr2chase, 17 months ago)

Change to Fortress.ast, missed from previous commit

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
24generateEmptyConstructor yes;   // for reflective object creation
25visitMethod accept;
26visitorMethodPrefix for;
27addGetterPrefixes yes;
28usePLT yes;
29tabSize 4;
30allowNulls no;
31generateToString no;
32generateEquals yes;
33generateSerializers yes;
34customClassPath ../build;
35customGenerator com.sun.fortress.astgen.FortressAstGenerator;
36customGenerator com.sun.fortress.astgen.TemplateVisitorGenerator;
37// customPreprocessor com.sun.fortress.astgen.TemplateGapNodeCreator;
38
39package com.sun.fortress.nodes;
40import java.math.BigInteger;
41import java.util.Collections;
42import java.util.List;
43import java.util.LinkedList;
44import java.util.Set;
45import com.sun.fortress.nodes_util.*;
46import com.sun.fortress.parser_util.*;
47import com.sun.fortress.parser_util.precedence_opexpr.*;
48import com.sun.fortress.useful.*;
49import edu.rice.cs.plt.tuple.Option;
50
51begin ast;
52
53/**
54 * top-level node interface
55 */
56interface Node(ignoreForEquals Span span = new Span()) extends HasAt;
57    /**
58     * declaration in components or APIs
59     */
60    interface AbsDeclOrDecl();
61        /**
62         * declaration in APIs
63         */
64        interface AbsDecl();
65        /**
66         * declaration in components
67         */
68        interface Decl();
69    /**
70     * left-hand-side of assignments, local variable declarations, or
71     * top-level declarations.
72     */
73    interface Lhs();
74    /**
75     * with static parameters
76     * implemented by trait, object, and function declarations and
77     * object expressions in components or APIs
78     */
79    interface Generic(List<StaticParam> staticParams);
80    /**
81     * with value parameters
82     * implemented by object declarations and object expressions in components
83     * or APIs
84     */
85    interface HasParams(Option<List<Param>> params,
86                        List<? extends AbsDeclOrDecl> decls);
87    /**
88     * with a where clause
89     * implemented by trait and object declarations in components or APIs
90     */
91    interface HasWhere(WhereClause where);
92    /**
93     * templates
94     */
95    interface TemplateGap(Id id, List<Id> templateParams);
96
97    /**
98     * intersections of interface types
99     */
100    interface GenericWithParams() extends Generic, HasParams;
101    interface GenericAbsDeclOrDecl() extends Generic, AbsDeclOrDecl;
102        interface GenericDecl() extends Decl;
103    interface GenericAbsDeclOrDeclWithParams() extends GenericWithParams,
104                                                       GenericAbsDeclOrDecl;
105        interface GenericDeclWithParams() extends GenericDecl;
106
107    /**
108     * type or the domain of an arrow type
109     */
110    interface TypeOrDomain();
111
112    /**
113     * top-level node abstract class
114     */
115    abstract AbstractNode() extends UIDObject;
116        /**
117         * compilation unit declaration
118         * CompilationUnit ::= Component | Api
119         */
120        abstract CompilationUnit(APIName name, List<Import> imports);
121            /**
122             * component declaration
123             * Component ::= native? component APIName Imports? Exports Decls? end
124             * e.g.) component Hello
125             *         export Executable
126             *         run(args:String...) = print "Hello, World!\n"
127             *       end
128             */
129            Component(boolean _native = false, APIName name, List<Import> imports,
130                      List<Export> exports, List<Decl> decls);
131            /**
132             * API declaration
133             * Api ::= api APIName Imports? AbsDecls? end
134             * e.g.) api Executable
135             *         run(args:String...):()
136             *       end
137             */
138            Api(List<AbsDecl> decls);
139        /**
140         * import statement
141         * Import ::= import ImportedNames | import api AliasedAPINames
142         */
143        abstract Import();
144            /**
145             * ImportedNames ::= APIName . {...} (except SimpleNames)?
146             *                 | APIName . { AliasedSimpleNameList (, ...)? }
147             *                 | QualifiedName (as Id)?
148             */
149            abstract ImportedNames(APIName api);
150                /**
151                 * Names must be unqualified.
152                 * e.g.) import Set.{...} except {opr UNION, union}
153                 */
154                ImportStar(List<IdOrOpOrAnonymousName> except);
155                /**
156                 * e.g.) import Set.{empty, union}
157                 */
158                ImportNames(List<AliasedSimpleName> aliasedNames);
159            /**
160             * e.g.) import api {Set, Map, List}
161             */
162            ImportApi(List<AliasedAPIName> apis);
163        /**
164         * aliased simple name used in import statements
165         * AliasedSimpleName ::= Id (as Id)?
166         *                     | opr Op (as Op)?
167         *                     | opr EncloserPair (as EncloserPair)?
168         * EncloserPair ::= (LeftEncloser | Encloser) (RightEncloser | Encloser)
169         * e.g.) longComplexName as shortName
170         * Names and aliases must be unqualified.
171         */
172        AliasedSimpleName(IdOrOpOrAnonymousName name,
173                          Option<IdOrOpOrAnonymousName> alias = Option.<IdOrOpOrAnonymousName>none());
174        /**
175         * aliased API name used in import statements
176         * AliasedAPIName ::= APIName (as Id)?
177         * e.g.) com.sun.fortress.parser.precedence.resolver as precedence_resolver
178         * Alias must be unqualified.
179         */
180        AliasedAPIName(APIName api,
181                       Option<Id> alias = Option.<Id>none());
182        /**
183         * export statement
184         * Export ::= export APINames
185         * e.g.) export Executable
186         */
187        Export(List<APIName> apis);
188        /**
189         * trait or object declaration in components or APIs
190         * Name must be unqualified.
191         */
192        abstract TraitObjectAbsDeclOrDecl(List<Modifier> mods
193                                              = Collections.<Modifier>emptyList(),
194                                          Id name,
195                                          List<StaticParam> staticParams
196                                              = Collections.<StaticParam>emptyList(),
197                                          List<TraitTypeWhere> extendsClause
198                                              = Collections.<TraitTypeWhere>emptyList(),
199                                          WhereClause where
200                                              = FortressUtil.emptyWhereClause(),
201                                          List<? extends AbsDeclOrDecl> decls)
202                                         implements HasWhere, GenericAbsDeclOrDecl;
203            /**
204             * trait declaration in components or APIs
205             */
206            abstract TraitAbsDeclOrDecl(List<BaseType> excludes
207                                            = Collections.<BaseType>emptyList(),
208                                        Option<List<BaseType>> comprises
209                                            = Option.<List<BaseType>>none(),
210                                        List<? extends AbsDeclOrDecl> decls);
211                /**
212                 * trait declaration in APIs
213                 * AbsTraitDecl ::= AbsTraitMods? TraitHeaderFront AbsTraitClauses
214                 *                  AbsGoInATrait? end
215                 * TraitHeaderFront ::= trait Id StaticParams? ExtendsWhere?
216                 * ExtendsWhere ::= extends TraitTypeWheres
217                 * AbsTraitClause ::= Excludes | AbsComprises | Where
218                 * Excludes ::= excludes TraitTypes
219                 * AbsComprises ::= comprises ComprisingTypes
220                 * ComprisingTypes ::= TraitType | { ComprisingTypeList }
221                 * ComprisingTypeList ::= ...
222                 *                      | TraitType(, TraitType)*(, ...)?
223                 * AbsGoInATrait ::= AbsCoercions? AbsGoFrontInATrait AbsGoBackInATrait?
224                 *                 | AbsCoercions? AbsGoBackInATrait
225                 *                 | AbsCoercions
226                 * AbsGoesFrontInATrait ::= ApiFldDecl
227                 *                        | AbsGetterSetterDecl
228                 *                        | PropertyDecl
229                 * AbsGoesBackInATrait  ::= AbsMdDecl
230                 *                        | PropertyDecl
231                 * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]}
232                 *         cons(x: alph): List[\alpha\]
233                 *       end
234                 */
235                AbsTraitDecl(List<AbsDecl> decls) implements AbsDecl;
236                /**
237                 * trait declaration in components
238                 * TraitDecl ::= TraitMods? TraitHeaderFront TraitClauses GoInATrait?
239                 *               end
240                 * TraitClause ::= Excludes | Comprises | Where
241                 * Comprises ::= comprises TraitTypes
242                 * GoInATrait ::= Coercions? GoFrontInATrait GoBackInATrait?
243                 *              | Coercions? GoBackInATrait
244                 *              | Coercions
245                 * GoesFrontInATrait ::= AbsFldDecl
246                 *                     | GetterSetterDecl
247                 *                     | PropertyDecl
248                 * GoesBackInATrait  ::= MdDecl
249                 *                     | PropertyDecl
250                 * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]}
251                 *         cons(x: alph): List[\alpha\] = Cons[\alph\](x, self)
252                 *       end
253                 */
254                TraitDecl(List<Decl> decls) implements GenericDecl;
255            /**
256             * object declaration in components or APIs
257             */
258            abstract ObjectAbsDeclOrDecl(Option<List<Param>> params
259                                             = Option.<List<Param>>none(),
260                                         Option<List<BaseType>> throwsClause
261                                             = Option.<List<BaseType>>none(),
262                                         Contract contract = new Contract(),
263                                         List<? extends AbsDeclOrDecl> decls)
264                                        implements GenericAbsDeclOrDeclWithParams;
265                /**
266                 * object declaration in APIs
267                 * AbsObjectDecl ::= AbsObjectMods? ObjectHeader AbsGoInAnObject? end
268                 * ObjectHeader ::= object Id StaticParams? ObjectValParam?
269                 *                  ExtendsWhere? FnClauses
270                 * FnClauses ::= Throws? Where? Contract
271                 * Throws ::= throws MayTraitTypes
272                 * ObjectValParam ::= ( ObjectParams? )
273                 * ObjectParams ::= (ObjectParam ,)* (ObjectVarargs, )? ObjectKeyword(, ObjectKeyword)*
274                 *                | (ObjectParam ,)* ObjectVarargs
275                 *                | ObjectParam (, ObjectParam)*
276                 * ObjectVarargs ::= transient Varargs
277                 * ObjectKeyword ::= ObjectParam = Expr
278                 * ObjectParam ::= ParamFldMods? Param
279                 *               | transient Param
280                 * AbsGoInAnObject ::= AbsCoercions? AbsGoFrontInAnObject AbsGoBackInAnObject?
281                 *                   | AbsCoercions? AbsGoBackInAnObject
282                 *                   | AbsCoercions
283                 * AbsGoesFrontInAnObject ::= ApiFldDecl
284                 *                          | AbsGetterSetterDecl
285                 *                          | PropertyDecl
286                 * AbsGoesBackInAnObject ::= AbsMdDecl
287                 *                         | PropertyDecl
288                 * e.g.) object Empty[\alph\]() extends List[\alpha\] end
289                 */
290                AbsObjectDecl(List<AbsDecl> decls) implements AbsDecl;
291                /**
292                 * object declaration in components
293                 * ObjectDecl ::= ObjectMods? ObjectHeader GoInAnObject? end
294                 * GoInAnObject ::= Coercions? GoFrontInAnObject GoBackInAnObject?
295                 *                | Coercions? GoBackInAnObject
296                 *                | Coercions
297                 * GoesFrontInAnObject ::= FldDecl
298                 *                       | GetterSetterDecl
299                 *                       | PropertyDecl
300                 * GoesBackInAnObject ::= MdDef
301                 *                      | PropertyDecl
302                 * e.g.) object Empty[\alph\]() extends List[\alpha\]
303                 *         length() = 0
304                 *       end
305                 */
306                ObjectDecl(List<Decl> decls)
307                          implements GenericDeclWithParams;
308        /**
309         * variable declaration in components or APIs
310         */
311        abstract VarAbsDeclOrDecl(List<LValueBind> lhs) implements AbsDeclOrDecl;
312            /**
313             * variable declaration in APIs
314             * AbsVarDecl ::= AbsVarMods? VarWTypes
315             *              | AbsVarMods? BindIdOrBindIdTuple : Type ...
316             *              | AbsVarMods? BindIdOrBindIdTuple : SimpleTupleType
317             * VarWTypes ::= VarWType | ( VarWType(, VarWType)+ )
318             * VarWType ::= BindId IsType
319             * BindIdOrBindIdTuple ::= BindId
320             *                       | ( BindId , BindIdList )
321             * BindId ::= Id | _
322             * e.g.) var (x, y): ZZ64...
323             */
324            AbsVarDecl() implements AbsDecl, Decl;
325            /**
326             * variable declaration in components
327             * VarDecl ::= VarMods? VarWTypes InitVal
328             *           | VarMods? BindIdOrBindIdTuple = Expr
329             *           | VarMods? BindIdOrBindIdTuple : Type ... InitVal
330             *           | VarMods? BindIdOrBindIdTuple : SimpleTupleType InitVal
331             * InitVal ::= (= | :=) Expr
332             * e.g.) var (x, y): ZZ64... = (5, 6)
333             */
334            VarDecl(Expr init) implements Decl;
335        /**
336         * left-hand side of variable declaration
337         */
338        abstract LValue();
339            /**
340             * e.g.) var x: ZZ32
341             * Name must be unqualified.
342             */
343            LValueBind(Id name, Option<Type> type = Option.<Type>none(),
344                       List<Modifier> mods = Collections.<Modifier>emptyList(),
345                       boolean mutable) implements Lhs;
346            /**
347             * left-hand side of matrix unpasting
348             * Unpasting ::= [ UnpastingElems ]
349             */
350            abstract Unpasting();
351                /**
352                 * simple unpasting
353                 * Names must be unqualified.
354                 * UnpastingElem ::= BindId ([ UnpastingDim ])?
355                 *                 | Unpasting
356                 * UnpastingDim ::= ExtentRange (BY ExtentRange)+
357                 * e.g.) squareShape[m BY m]
358                 */
359                UnpastingBind(Id name, List<ExtentRange> dim);
360                /**
361                 * complex unpasting
362                 * UnpastingElems ::= UnpastingElem RectSeparator UnpastingElems
363                 *                  | UnpastingElem
364                 * e.g.) squareShape[m BY m]  rest
365                 */
366                UnpastingSplit(List<Unpasting> elems, int dim);
367        /**
368         * functional declaration in components or APIs
369         * Names must be unqualified.
370         */
371        abstract FnAbsDeclOrDecl(List<Modifier> mods
372                                     = Collections.<Modifier>emptyList(),
373                                 IdOrOpOrAnonymousName name,
374                                 List<StaticParam> staticParams
375                                     = Collections.<StaticParam>emptyList(),
376                                 List<Param> params,
377                                 Option<Type> returnType
378                                     = Option.<Type>none(),
379                                 Option<List<BaseType>> throwsClause
380                                     = Option.<List<BaseType>>none(),
381                                 WhereClause where
382                                     = FortressUtil.emptyWhereClause(),
383                                 Contract contract = new Contract(),
384                                 String selfName = NodeUtil.defaultSelfName)
385                                implements Applicable, GenericDecl;
386            /**
387             * functional declaration in components or APIs
388             * AbsFnDecl ::= AbsFnMods? FnHeaderFront FnHeaderClause
389             *             | FnSig
390             * FnSig ::= SimpleName : ArrowType
391             * FnHeaderFront ::= NamedFnHeaderFront
392             *                 | OpHeaderFront
393             * NamedFnHeaderFront ::= Id StaticParams? ValParam
394             * OpHeaderFront ::= opr StaticParams? BIG? (LeftEncloser | Encloser)
395             *                     Params (RightEncloser | Encloser)
396             *                 | opr StaticParams? ValParam (Op | ExponentOp)
397             *                 | opr BIG? (Op | ^ | Encloser) StaticParams? ValParam
398             * FnHeaderClause ::= IsType? FnClauses
399             * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause
400             *          | FnSig
401             * e.g.) swap (x: Object, y: Object): (Object, Object)
402             */
403            AbsFnDecl() implements AbsDecl;
404            /**
405             * functional declaration in components
406             */
407            abstract FnDecl();
408                /**
409                 * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr
410                 * e.g.) swap (x, y) = (y, x)
411                 */
412                FnDef(Expr body);
413        /**
414         * value parameter of functional declarations and object declarations
415         * Names must be unqualified.
416         */
417        abstract Param(List<Modifier> mods = Collections.<Modifier>emptyList(),
418                       Id name);
419            /**
420             * ValParam := BindId
421             *           | ( Params? )
422             * Params ::= (Param, )* (Varargs, )? Keyword(, Keyword)*
423             *          | (Param, )* Varargs
424             *          | Param(, Param)*
425             * Keyword ::= Param = Expr
426             * Param ::= BindId IsType?
427             *         | Type
428             * e.g.) x: ZZ32 = 3
429             * e.g.) self
430             * e.g.) transient x: String
431             */
432            NormalParam(Option<Type> type = Option.<Type>none(),
433                        Option<Expr> defaultExpr = Option.<Expr>none());
434            /**
435             * varargs parameter
436             * Varargs ::= BindId : Type ...
437             * e.g.) x: String...
438             */
439            VarargsParam(Type type);
440        /**
441         * dimension and unit declaration
442         * DimUnitDecl may represent a single dimension declaration, a single
443         * unit declaration, or both dimension and unit declarations.
444         * DimUnitDecl ::= dim Id (= Type)? (unit | SI_unit) Id+ (= Expr)?
445         *               | dim Id (= Type)? (default Id)?
446         *               | (unit | SI_unit) Id+ (: Type)? (= Expr)?
447         */
448        abstract DimUnitDecl() implements Decl, AbsDecl;
449            /**
450             * dimension declaration
451             * Names for dim and default must be unqualified.
452             * e.g.) dim Length SI_unit meter meters m
453             */
454            DimDecl(Id dim, Option<Type> derived = Option.<Type>none(),
455                    Option<Id> default = Option.<Id>none());
456            /**
457             * unit declaration
458             * Names of units must be unqualified.
459             * e.g.) unit inch inches: Length
460             */
461            UnitDecl(boolean si_unit = false,
462                     List<Id> units = Collections.<Id>emptyList(),
463                     Option<Type> dim = Option.<Type>none(),
464                     Option<Expr> def);
465        /**
466         * test declaration
467         * Names must be unqualified.
468         * TestDecl ::= test Id [ GeneratorClauseList ] = Expr
469         * e.g.) test fxLessThanFy[x <- E, y <- F] = assert(f(x) < f(y))
470         */
471        TestDecl(Id name, List<GeneratorClause> gens, Expr expr)
472                implements Decl, AbsDecl;
473        /**
474         * property declaration
475         * Names must be unqualified.
476         * PropertyDecl ::= property (Id = )? (FORALL ValParam)? Expr
477         * e.g.) property fIsMonotonic = FORALL (x:ZZ, y:ZZ) (x < y) -> (f(x) < f(y))
478         */
479        PropertyDecl(Option<Id> name = Option.<Id>none(), List<Param> params,
480                     Expr expr) implements Decl, AbsDecl;
481        /**
482         * syntax expanders declaration in components or APIs
483         * Names and expanders must be unqualified.
484         */
485        abstract ExternalSyntaxAbsDeclOrDecl(IdOrOpOrAnonymousName openExpander, Id name,
486                                             IdOrOpOrAnonymousName closeExpander)
487                                            implements AbsDeclOrDecl;
488            /**
489             * syntax expanders declaration in APIs
490             * AbsExternalSyntax ::= syntax OpenExpander Id CloseExpander
491             * OpenExpander ::= Id
492             *                | (LeftEncloser / Encloser)
493             * CloseExpander ::= Id
494             *                 | (RightEncloser / Encloser)
495             *                 | end
496             * e.g.) syntax sql e end
497             */
498            AbsExternalSyntax() implements AbsDecl;
499            /**
500             * syntax expanders declaration in APIs
501             * ExternalSyntax ::= syntax OpenExpander Id CloseExpander = Expr
502             * e.g.) syntax sql e end = parseSQL(e)
503             */
504            ExternalSyntax(Expr expr) implements Decl;
505        /**
506         * grammar declaration
507         * Names (but not extends elements) must be unqualified.
508         */
509        abstract GrammarDecl(Id name, List<Id> extends) implements AbsDecl;
510            /**
511             * grammar definition in grammar declarations
512             */
513            GrammarDef(List<GrammarMemberDecl> members);
514        /**
515         * grammar member (nonterminal or terminal) declaration
516         * Names and params must be unqualified.
517         */
518        abstract GrammarMemberDecl(NonterminalHeader header,
519                                   Option<BaseType> astType) implements AbsDecl;
520            /**
521             * nonterminal declaration
522             */
523            abstract NonterminalDecl(List<SyntaxDef> syntaxDefs);
524                /**
525                 * nonterminal definition in nonterminal declarations
526                 */
527                NonterminalDef();
528                /**
529                 * nonterminal extending definition in nonterminal declarations
530                 */
531                NonterminalExtensionDef();
532            /**
533             * terminal declaration
534             */
535            abstract TerminalDecl(SyntaxDef syntaxDef);
536                /**
537                 * terminal definition result of rewrite of keyword and token symbols in disambigutation of
538                 * syntax abstractions
539                 */
540                _TerminalDef();
541        /**
542         * nonterminal header
543         */
544        NonterminalHeader(Option<ModifierPrivate> modifier
545                            = Option.<ModifierPrivate>none(),
546                          Id name,
547                          List<NonterminalParameter> params,
548                          List<StaticParam> staticParams
549                            = Collections.<StaticParam>emptyList(),
550                          Option<Type> type,
551                          WhereClause whereClause
552                            = FortressUtil.emptyWhereClause());
553
554        /**
555         * nonterminal parameter
556         */
557        NonterminalParameter(Id name, BaseType type);
558
559        /**
560         * syntax declaration
561         */
562        abstract SyntaxDecl() implements AbsDecl;
563            /**
564             * syntax definition in syntax declarations
565             */
566            SyntaxDef(List<SyntaxSymbol> syntaxSymbols,
567                      TransformationDecl transformation);
568        /**
569          * Transformation declaration
570          */
571        abstract TransformationDecl() implements AbsDecl;
572            /**
573             * pre template definition in template declarations
574             */
575            TransformationPreTemplateDef(String productionName, String transformation);
576            /**
577             * template definition in template declarations
578             */
579            TransformationTemplateDef(AbstractNode transformation);
580            /**
581             * template definition in template declarations
582             */
583            TransformationExpressionDef(Expr transformation);
584        /**
585          * syntax symbol
586          */
587        abstract SyntaxSymbol();
588            /**
589             * prefixed syntax symbol
590             */
591            PrefixedSymbol(Option<Id> id, Option<Type> type = Option.<Type>none(), SyntaxSymbol symbol);
592            /**
593             * optional syntax symbol
594             */
595            OptionalSymbol(SyntaxSymbol symbol);
596            /**
597             * repeat zero-or-more syntax symbol
598             */
599            RepeatSymbol(SyntaxSymbol symbol);
600            /**
601             * repeat one-or-more syntax symbol
602             */
603            RepeatOneOrMoreSymbol(SyntaxSymbol symbol);
604            /**
605             * ignore following whitespace syntax symbol
606             */
607            NoWhitespaceSymbol(SyntaxSymbol symbol);
608            /**
609             * groups of symbols
610             */
611            GroupSymbol(List<SyntaxSymbol> symbols);
612            /**
613             * special symbols syntax symbol
614             */
615            abstract SpecialSymbol();
616                /**
617                 * any character syntax symbol
618                 */
619                AnyCharacterSymbol();
620                /**
621                 * whitespace syntax symbol
622                 */
623                WhitespaceSymbol(String s);
624                /**
625                 * tab syntax symbol
626                 */
627                TabSymbol();
628                /**
629                 * formfeed syntax symbol
630                 */
631                FormfeedSymbol();
632                /**
633                 * carriage return syntax symbol
634                 */
635                CarriageReturnSymbol();
636                /**
637                 * backspace syntax symbol
638                 */
639                BackspaceSymbol();
640                /**
641                 * newline syntax symbol
642                 */
643                NewlineSymbol();
644                /**
645                 * breakline syntax symbol
646                 */
647                BreaklineSymbol(String s);
648            /**
649             * item syntax symbol
650             */
651            ItemSymbol(String item);
652            /**
653             * non-terminal syntax symbol
654             */
655            NonterminalSymbol(Id nonterminal);
656            /**
657             * keyword syntax symbol
658             */
659            KeywordSymbol(String token);
660            /**
661             * token syntax symbol
662             */
663            TokenSymbol(String token);
664            /**
665             * not predicate syntax symbol
666             */
667            NotPredicateSymbol(SyntaxSymbol symbol);
668            /**
669             * and predicate syntax symbol
670             */
671            AndPredicateSymbol(SyntaxSymbol symbol);
672            /**
673             * character class syntax symbol
674             */
675            CharacterClassSymbol(List<CharacterSymbol> characters);
676            /**
677             * character symbols
678             */
679            abstract CharacterSymbol();
680                /**
681                 * character
682                 */
683                CharSymbol(String string);
684                /**
685                 * character interval
686                 */
687                CharacterInterval(String begin, String end);
688        /**
689         * expression
690         */
691        abstract Expr(boolean parenthesized = false);
692
693            /**
694             * Repeated expression in a macro
695             */
696            _EllipsesExpr(Expr expr);
697
698            /**
699             * Template gap for expressions
700             */
701            TemplateGapExpr(Id id, List<Id> templateParams) implements TemplateGap;
702            /**
703             * expression annotated with a type
704             */
705            abstract TypeAnnotatedExpr(Expr expr, Type type);
706                /**
707                 * type ascription expression
708                 * Expr ::= Expr as Type
709                 * e.g.) 3 as Number
710                 */
711                AsExpr();
712                /**
713                 * type assumption expression
714                 * Expr ::= Expr asif Type
715                 * e.g.) Empty asif List[\String\]
716                 */
717                AsIfExpr();
718            /**
719             * assignment expression
720             * AssignExpr ::= AssignLefts AssignOp Expr
721             * AssignLefts ::= ( AssignLeft(, AssignLeft)* )
722             *               | AssignLeft
723             * AssignLeft ::= SubscriptExpr
724             *              | FieldSelection
725             *              | QualifiedName
726             * FieldSelection ::= Primary . Id
727             * AssignOp ::= := | Op=
728             * e.g.) x += 1
729             */
730            Assignment(List<Lhs> lhs, Option<OpRef> opr, Expr rhs);
731            /**
732             * expressions beginning and ending with reserved words
733             * Expr ::= DelimitedExpr
734             */
735            abstract DelimitedExpr();
736                /**
737                 * Template gap for expressions
738                 */
739                TemplateGapDelimitedExpr(Id id, List<Id> templateParams) implements TemplateGap;
740                /**
741                 * sequence of block elements implicitly enclosed by do/end
742                 * BlockElems ::= BlockElem+
743                 * e.g.) y = x
744                 *       z = 2x
745                 *       y + z
746                 */
747                Block(List<Expr> exprs);
748                /**
749                 * case expression or extremum expression
750                 * DelimitedExpr ::= case Expr Op? of CaseClauses CaseElse? end
751                 *                 | case most Op of CaseClauses end
752                 * CaseElse ::= else => BlockElems
753                 * e.g.) case most > of
754                 *         1 mile => "miles are larger"
755                 *         1 kilometer => "we were wrong again"
756                 *       end
757                 *  eqOp and inOp are to help with disambiguation
758                 */
759                CaseExpr(Option<Expr> param, Option<OpRef> compare = Option.<OpRef>none(),
760                         OpRef equalsOp = ExprFactory.makeInfixEq(), OpRef inOp= ExprFactory.makeInfixIn(),
761                         List<CaseClause> clauses,
762                         Option<Block> elseClause = Option.<Block>none());
763                /**
764                 * do expression
765                 * Do ::= (DoFront also)* DoFront end
766                 * e.g.) do
767                 *         accum += treeSum(t.left)
768                 *       also do
769                 *         accum += treeSum(t.right)
770                 *       also do
771                 *         accum += t.datum
772                 *       end
773                 */
774                Do(List<DoFront> fronts);
775                /**
776                 * for expression
777                 * DelimitedExpr ::= for GeneratorClauseList DoFront end
778                 * e.g.) for i <- sequential(1:5) do
779                 *         print (i " ")
780                 *       end
781                 */
782                For(List<GeneratorClause> gens, DoFront body);
783                /**
784                 * if expression
785                 * DelimitedExpr ::= if CondExpr then BlockElems Elifs? Else? end
786                 *                 | ( if CondExpr then BlockElems Elifs? Else end? )
787                 * Elif ::= elif CondExpr then BlockElems
788                 * Else ::= else BlockElems
789                 * CondExpr ::= BindId <- Expr
790                 *            | Expr
791                 * e.g.) if x IN {0, 1, 2} then 0
792                 *       elif x IN {3, 4, 5} then 3
793                 *       else 6 end
794                 */
795                If(List<IfClause> clauses,
796                   Option<Block> elseClause = Option.<Block>none());
797                /**
798                 * label expression
799                 * Names must be unqualified.
800                 * DelimitedExpr ::= label Id BlockElems end Id
801                 * e.g.) label I_95
802                 *         if goingTo(Sun)
803                 *         then exit I_95 with x32B
804                 *         else x32A
805                 *         end
806                 *       end I_95
807                 */
808                Label(Id name, Block body);
809                /**
810                 * object expression
811                 */
812                abstract AbstractObjectExpr(List<TraitTypeWhere> extendsClause
813                                                = Collections.<TraitTypeWhere>emptyList(),
814                                            List<Decl> decls);
815                    /**
816                     * object expression
817                     * DelimitedExpr ::= object ExtendsWhere? GoInAnObject? end
818                     * e.g.)  object extends {List}
819                     *          cons(x) = Cons(x, self)
820                     *          append (xs) = xs
821                     *        end
822                     */
823                    ObjectExpr();
824                    /**
825                     * object expression rewritten by interpreter.rewrite.Disambiguate
826                     */
827                    _RewriteObjectExpr(BATree<String, StaticParam> implicitTypeParameters,
828                                       String genSymName,
829                                       List<StaticParam> staticParams,
830                                       List<StaticArg> staticArgs,
831                                       Option<List<Param>> params)
832                                      implements GenericWithParams;
833                /**
834                 * try expression
835                 * DelimitedExpr ::= try BlockElems Catch? (forbid TraitTypes)?
836                 *                     (finally BlockElems)? end
837                 * e.g.) try
838                 *         inp = read (file)
839                 *         write (inp, newFile)
840                 *       forbid IOException
841                 *       end
842                 */
843                Try(Block body, Option<Catch> catchClause = Option.<Catch>none(),
844                    List<BaseType> forbid = Collections.<BaseType>emptyList(),
845                    Option<Block> finallyClause = Option.<Block>none());
846                /**
847                 * labeled expression: tuple expression or argument expression
848                 */
849                abstract AbstractTupleExpr(List<Expr> exprs);
850                    /**
851                     * tuple expression
852                     * TupleExpr ::= ( (Expr,)+ Expr )
853                     * e.g.) (1, 2, 5)
854                     */
855                    TupleExpr();
856                    /**
857                     * argument expression
858                     * ArgExpr ::= ( (Expr,)* (Expr...,)? KeywordExpr(, KeywordExpr)* )
859                     *           | ( (Expr,)* Expr... )
860                     *           | TupleExpr
861                     * e.g.) (1, 2, [3 4]..., x = 5)
862                     */
863                    ArgExpr(Option<VarargsExpr> varargs
864                                = Option.<VarargsExpr>none(),
865                            List<KeywordExpr> keywords
866                                = Collections.<KeywordExpr>emptyList(),
867                            boolean inApp = false);
868                /**
869                 * typecase expression
870                 * DelimitedExpr ::= typecase TypecaseBindings of TypecaseClauses
871                 *                     CaseElse? end
872                 * TypecaseBindings ::= TypecaseVars (= Expr)?
873                 * TypecaseVars ::= BindId
874                 *              |   ( BindId(, BindId)+ )
875                 * e.g.) typecase x = myLoser .myField of
876                 *         String => x.append("foo")
877                 *         Number => x + 3
878                 *         Object => yogiBerraAutograph
879                 *       end
880                 * Names in bind must be unqualified.
881                 */
882                Typecase(List<Id> bindIds, Option<Expr> bindExpr,
883                         List<TypecaseClause> clauses,
884                         Option<Block> elseClause = Option.<Block>none());
885                /**
886                 * while expression
887                 * DelimitedExpr ::= while GeneratorClause Do
888                 * e.g.) while x < 10 do print x; x += 1 end
889                 */
890                While(GeneratorClause test, Do body);
891            /**
892             * control flow expression
893             * Expr ::= FlowExpr
894             */
895            abstract FlowExpr();
896                /**
897                 * comprehension or accumulator
898                 */
899                abstract BigOpApp(List<StaticArg> staticArgs
900                                      = Collections.<StaticArg>emptyList());
901                    /**
902                     * summation and other reduction expression
903                     * FlowExpr ::= Accumulator StaticArgs?
904                     *                ([ GeneratorClauseList ])? Expr
905                     * Accumulator ::= SUM | PRODUCT | Big Op
906                     * e.g.) PRODUCT[i <- 1:n] i
907                     */
908                    Accumulator(OpName opr, List<GeneratorClause> gens, Expr body);
909                    /**
910                     * array comprehension
911                     * Comprehension ::= BIG? [ StaticArgs? ArrayComprehensionClause+
912                     *                        ]
913                     * e.g.) [(x, y, 1) |-> 0.0 | x <- 1:xSize, y <- 1:ySize ]
914                     */
915                    ArrayComprehension(List<ArrayComprehensionClause> clauses);
916                /**
917                 * atomic expression
918                 * FlowExpr ::= atomic AtomicBack
919                 * AtomicBack ::= AssignExpr
920                 *              | OpExpr
921                 *              | DelimitedExpr
922                 * e.g.) atomic sum += a[i]
923                 */
924                AtomicExpr(Expr expr);
925                /**
926                 * exiting labeled expressions
927                 * FlowExpr ::= exit Id? (with Expr)?
928                 * e.g.) exit I_95 with x32B
929                 * Targets must be unqualified.
930                 */
931                Exit(Option<Id> target = Option.<Id>none(),
932                     Option<Expr> returnExpr = Option.<Expr>none());
933                /**
934                 * spawn expression
935                 * FlowExpr ::= spawn Expr
936                 * e.g.) spawn mm(lefttop, right, resulttop)
937                 */
938                Spawn(Expr body);
939                /**
940                 * throw expression
941                 * FlowExpr ::= throw Expr
942                 * e.g.) throw Error
943                 */
944                Throw(Expr expr);
945                /**
946                 * tryatomic expression
947                 * FlowExpr ::= tryatomic AtomicBack
948                 * e.g.) tryatomic sum += a[i]
949                 */
950                TryAtomicExpr(Expr expr);
951            /**
952             * function expression
953             * Names must be unqualified.
954             * Expr ::= fn ValParam IsType? Throws? => Expr
955             * e.g.) fn x => x + 2
956             */
957            FnExpr(ignoreForEquals Span span, // no default -- required to produce a fnName
958                   boolean parenthesized = false,
959                   IdOrOpOrAnonymousName name = new AnonymousFnName(in_span),
960                   List<StaticParam> staticParams
961                       = Collections.<StaticParam>emptyList(),
962                   List<Param> params,
963                   Option<Type> returnType = Option.<Type>none(),
964                   WhereClause where = FortressUtil.emptyWhereClause(),
965                   Option<List<BaseType>> throwsClause
966                       = Option.<List<BaseType>>none(),
967                   Expr body)
968                  implements Applicable;
969                /**
970                 * Template gap for FnExpr
971                 */
972                TemplateGapFnExpr(Id id, List<Id> templateParams) implements TemplateGap;
973            /**
974             * expression used in block expressions
975             * BlockElem ::= LocalVarFnDecl
976             *             | Expr(, GeneratorClauseList)?
977             * LocalVarFnDecl ::= LocalFnDecl+
978             *                  | LocalVarDecl
979             */
980            abstract LetExpr(List<Expr> body);
981                /**
982                 * local function declaration
983                 * LocalFnDecl ::= LocalFnMods? NamedFnHeaderFront FnHeaderClause
984                 *                   = Expr
985                 * e.g.) localFn(x: ZZ32) = x + 2
986                 */
987                LetFn(List<FnDef> fns);
988                /**
989                 * local variable declaration
990                 * LocalVarDecl ::= var? LocalVarWTypes InitVal
991                 *                | var? LocalVarWTypes
992                 *                | var? LocalVarWoTypes = Expr
993                 *                | var? LocalVarWoTypes : Type ... InitVal?
994                 *                | var? LocalVarWoTypes : SimpleTupleType InitVal?
995                 * LocalVarWTypes ::= LocalVarWType
996                 *                  | ( LocalVarWType(, LocalVarWType)+ )
997                 * LocalVarWType ::= BindId IsType
998                 * LocalVarWoTypes ::= LocalVarWoType
999                 *                   | ( LocalVarWoType(, LocalVarWoType)+ )
1000                 * LocalVarWoType ::= BindId
1001                 *                  | Unpasting
1002                 * e.g.) localVar x = 3
1003                 */
1004                LocalVarDecl(List<LValue> lhs,
1005                             Option<Expr> rhs = Option.<Expr>none());
1006            /**
1007             * generated expression
1008             * BlockElem ::= Expr(, GeneratorClauseList)?
1009             * e.g.) print (i " "), i <- sequential(1:5)
1010             */
1011            GeneratedExpr(Expr expr, List<GeneratorClause> gens);
1012            /**
1013             * expression that is simple or using operators
1014             * Expr ::= OpExpr
1015             */
1016            abstract SimpleExpr();
1017                /**
1018                 * Template gap for simple expressions
1019                 */
1020                TemplateGapSimpleExpr(Id id, List<Id> templateParams) implements TemplateGap;
1021                /**
1022                 * subscripting expression
1023                 * SubscriptExpr ::= Primary LeftEncloser ExprList? RightEncloser
1024                 * e.g.) a[i]
1025                 */
1026                SubscriptExpr(Expr obj, List<Expr> subs,
1027                              Option<Enclosing> op = Option.<Enclosing>none(),
1028                              List<StaticArg> staticArgs
1029                                  = Collections.<StaticArg>emptyList())
1030                              implements Lhs;
1031                /**
1032                 * primary expression
1033                 */
1034                abstract Primary();
1035                    /**
1036                     * Template gap for primary expressions
1037                     */
1038                    TemplateGapPrimary(Id id, List<Id> templateParams) implements TemplateGap;
1039                    /**
1040                     * literal
1041                     * Primary ::= LiteralExpr
1042                     */
1043                    abstract LiteralExpr(String text);
1044                        /**
1045                         * Template gap for literal expressiont
1046                         */
1047                        TemplateGapLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1048                        /**
1049                         * number literal
1050                         */
1051                        abstract NumberLiteralExpr();
1052                            /**
1053                             * Template gap for number literals
1054                             */
1055                            TemplateGapNumberLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1056                            /**
1057                             * float literal
1058                             * e.g.) 3.5
1059                             */
1060                            FloatLiteralExpr(ignoreForEquals String text,
1061                                             BigInteger intPart,
1062                                             BigInteger numerator, int denomBase,
1063                                             int denomPower);
1064                                /**
1065                                 * Template gap for float literals
1066                                 */
1067                                TemplateGapFloatLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1068                            /**
1069                             * int literal
1070                             * e.g.) 7
1071                             */
1072                            IntLiteralExpr(String text = in_val.toString(),
1073                                           BigInteger val);
1074                                /**
1075                                 * Template gap for int literals
1076                                 */
1077                                TemplateGapIntLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1078                        /**
1079                         * char literal
1080                         * e.g.) 'c'
1081                         */
1082                        CharLiteralExpr(int val = in_text.charAt(0));
1083                            /**
1084                             * Template gap for char literals
1085                             */
1086                            TemplateGapCharLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1087                        /**
1088                         * string literal
1089                         * e.g.) "string"
1090                         */
1091                        StringLiteralExpr();
1092                            /**
1093                             * Template gap for string literals
1094                             */
1095                            TemplateGapStringLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1096                        /**
1097                         * void literal
1098                         * e.g.) ()
1099                         */
1100                        VoidLiteralExpr(String text = "");
1101                            /**
1102                             * Template gap for void literals
1103                             */
1104                            TemplateGapVoidLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap;
1105                    /**
1106                     * variable reference
1107                     * VarOrFnRef ::= Id
1108                     * Primary ::= self
1109                     * e.g.) length
1110                     */
1111                    VarRef(Id var, int lexicalDepth=-2147483648) implements Lhs;
1112                    /**
1113                     * A reference to a singleton object. Created at typechecking or disambiguation-time.
1114                     * Necessary because object references are initially parsed as FnRefs.
1115                     * e.g.) Foo[\ZZ32\]
1116                     * where Foo was defined as
1117                     * object Foo[\T\] ... end
1118                     */
1119                    _RewriteObjectRef(Id obj, List<StaticArg> staticArgs);
1120                    /**
1121                     * field selection expression
1122                     * Primary ::= Primary . Id
1123                     */
1124                    abstract AbstractFieldRef(Expr obj) implements Lhs;
1125                        /**
1126                         * A field selection, unless it is a method reference
1127                         * Names of "field" must be unqualified.
1128                         * e.g.) Empty.length
1129                         */
1130                        FieldRef(Id field);
1131                        /**
1132                         * A rewritten field ref (not a getter/setter)
1133                         * also used to disambiguate lexical references to self/parent
1134                         * and within objectexprs to get access to outer scopes
1135                         * where the vars in the outer scopes may in turn have been
1136                         * API-qualified.
1137                         *
1138                         * If the reference to outer scope can be "fixed" (there is
1139                         * only one out scope) then it might be good to narrow this
1140                         * back down to an Id.
1141                         *
1142                         * Names of "field" must be unqualified.
1143                         */
1144                        _RewriteFieldRef(Name field);
1145                    /**
1146                     * named functional in functional applications
1147                     */
1148                    abstract FunctionalRef(List<StaticArg> staticArgs
1149                                             = Collections.<StaticArg>emptyList(), int lexicalDepth=-2147483648);
1150                        /**
1151                         * expression with static instantiations
1152                         * list of ids allows cross-API overloading
1153                         * Primary ::= Id[\StaticArgList\]
1154                         * e.g.) identity[\String\]
1155                         */
1156                        FnRef(Id originalName,
1157                              List<Id> fns = Collections.<Id>singletonList(in_originalName),
1158                              List<StaticArg> staticArgs
1159                                  = Collections.<StaticArg>emptyList());
1160                        /**
1161                         * The rewriting to explicitly name self and parent
1162                         * pre-interpretation may generalize the dotted
1163                         * list from a FnRef into something else.
1164                         */
1165                        _RewriteFnRef(Expr fn,
1166                                      List<StaticArg> staticArgs
1167                                  = Collections.<StaticArg>emptyList());
1168                        /**
1169                         * operator name with (inferred) static instantiations
1170                         * list of operators allows cross-API overloading
1171                         * Primary ::= Op[\StaticArgList\]
1172                         * e.g.) +[\String\]
1173                         */
1174                        OpRef(OpName originalName,
1175                              List<OpName> ops = Collections.<OpName>singletonList(in_originalName),
1176                              List<StaticArg> staticArgs
1177                                  = Collections.<StaticArg>emptyList());
1178                    /**
1179                     * functional applicaiton
1180                     */
1181                    abstract AppExpr();
1182                        /**
1183                         * juxtaposition of expressions
1184                         * If this node turns out to actually be a juxtaposition,
1185                         * based on the types, the op field is a reference to
1186                         * the operator that should be used.
1187                         *
1188                         * Primary ::= Primary . Id StaticArgs? ParenthesisDelimited
1189                         *           | Primary TupleExpr
1190                         *           | Primary Primary
1191                         * e.g.) myString.replace("foo", "few")
1192                         * e.g.) log log n
1193                         */
1194                        abstract Juxt(OpRef multiJuxt = ExprFactory.makeMultiJuxt(),
1195                                      OpRef infixJuxt = ExprFactory.makeInfixJuxt(),
1196                                      List<Expr> exprs = new LinkedList<Expr>());
1197                            /**
1198                             * juxtaposition with intervening whitespace
1199                             * e.g.) 3 5
1200                             */
1201                            LooseJuxt();
1202                                /**
1203                                 * Template gap for expressions
1204                                 */
1205                                TemplateGapLooseJuxt(Id id, List<Id> templateParams) implements TemplateGap;
1206                           /**
1207                             * juxtaposition without intervening whitespace
1208                             * e.g.) f(3+5)
1209                             */
1210                            TightJuxt();
1211                        /**
1212                         * functional application
1213                         * Primary ::= Primary ArgExpr
1214                         *           | Primary Primary
1215                         * e.g.) x y
1216                         */
1217                        _RewriteFnApp(Expr function, Expr argument);
1218                        /**
1219                         * expression using operators
1220                         * (list of ops allows cross-API overloading)
1221                         * OpExpr ::= EncloserOp OpExpr? EncloserOp?
1222                         *          | OpExpr EncloserOp OpExpr?
1223                         *          | Primary
1224                         * EncloserOp ::= Encloser
1225                         *              | Op
1226                         * Primary ::= LeftEncloser ExprList? RightEncloser
1227                         *           | Primary ^ Exponent
1228                         *           | Primary ExponentOp
1229                         * e.g.) 3 + 5
1230                         */
1231                        OpExpr(OpRef op,
1232                               List<Expr> args = Collections.<Expr>emptyList());
1233                        /**
1234                         * chain expression
1235                         * Certain infix mathematical operators that are
1236                         * traditionally regarded as relational operators,
1237                         * delivering boolean results, may be chained.
1238                         * e.g.) A SUBSETEQ B SUBSET C SUBSETEQ D
1239                         */
1240                        ChainExpr(Expr first, List<Link> links);
1241                        /**
1242                         * coercion invocation
1243                         * internal node created by static analysis
1244                         * after inferring the implicit coercion invocations
1245                         */
1246                        CoercionInvocation(BaseType type,
1247                                           List<StaticArg> staticArgs
1248                                               = Collections.<StaticArg>emptyList(),
1249                                           Expr arg);
1250                        /**
1251                         * a method invocation
1252                         * some are created by parsing, while others require later
1253                         * static analysis to disambiguate from function applications
1254                         *
1255                         * Names of "method" must be unqualified.
1256                         * e.g.) myString.toUppercase()
1257                         */
1258                        MethodInvocation(Expr obj, Id method,
1259                                         List<StaticArg> staticArgs
1260                                             = Collections.<StaticArg>emptyList(),
1261                                         Expr arg);
1262                    /**
1263                     * primary expression without any dots
1264                     * MathPrimary ::= PrimaryFront MathItem*
1265                     * e.g.) a[3, 4]
1266                     */
1267                    MathPrimary(OpRef multiJuxt = ExprFactory.makeMultiJuxt(),
1268                                OpRef infixJuxt = ExprFactory.makeInfixJuxt(),
1269                                Expr front, List<MathItem> rest);
1270                    /**
1271                     * array expression
1272                     * ArrayExpr ::= [ StaticArgs? RectElements ]
1273                     * RectElements ::= Expr MultiDimCons*
1274                     * MultiDimCons ::= RectSeparator Expr
1275                     * RectSeparator ::= ;+
1276                     *                 | Whitespace
1277                     * e.g.) [1 2 3; 4 5 6; 7 8 9]
1278                     */
1279                    abstract ArrayExpr(List<StaticArg> staticArgs
1280                                           = Collections.<StaticArg>emptyList());
1281                        /**
1282                         * array with a single element
1283                         * e.g.) [3]
1284                         */
1285                        ArrayElement(Expr element);
1286                        /**
1287                         * array with multiple elements
1288                         * e.g.) [3 4 5; 6 7 8]
1289                         */
1290                        ArrayElements(int dimension, List<ArrayExpr> elements);
1291        /**
1292         * type
1293         */
1294        abstract Type(ignoreForEquals boolean parenthesized = false)
1295                     implements TypeOrDomain;
1296            /**
1297             * dimension expression (not really a type, but here for
1298             * now because of the way the parser is defined)
1299             */
1300            abstract DimExpr();
1301                /* vector type or exponent dimemsion
1302                 * resolved during parsing
1303                 * e.g.) ZZ32^3
1304                 * e.g.) Time^2
1305                 */
1306                ExponentType(Type base, IntExpr power);
1307                /* base dimension
1308                 * DimExpr ::= Unity
1309                 * e.g.) Unity
1310                 */
1311                BaseDim();
1312                /* dimension identifier
1313                 * DimExpr ::= QualifiedName
1314                 * e.g.) com.sun.fortress.dim.Length
1315                 */
1316                DimRef(Id name);
1317                /* dimension multiplication
1318                 * DimExpr ::= DimExpr DOT DimExpr
1319                 *           | DimExpr DimExpr
1320                 * e.g.) Length Mass
1321                 */
1322                ProductDim(DimExpr multiplier, DimExpr multiplicand);
1323                /* dimension division
1324                 * DimExpr ::= DimExpr / DimExpr
1325                 *           | DimExpr per DimExpr
1326                 *           | 1 / DimExpr
1327                 * e.g.) Length / Time
1328                 */
1329                QuotientDim(DimExpr numerator, DimExpr denominator);
1330                /* dimension exponentiation
1331                 * DimExpr ::= DimExpr ^ IntExpr
1332                 * e.g.) Time^2
1333                 */
1334                ExponentDim(DimExpr base, IntExpr power);
1335                /* dimension with operator
1336                 * DimExpr ::= DimPrefixOp DimExpr
1337                 *           | DimExpr DimPostfixOp
1338                 * e.g.) Time squared
1339                 */
1340                OpDim(DimExpr val, Op op);
1341            /**
1342             * base types: things that can be extended, excluded, thrown, etc.
1343             */
1344            abstract BaseType();
1345                /**
1346                 * any type
1347                 * e.g.) Any
1348                 */
1349                AnyType();
1350                /**
1351                 * bottom type
1352                 * internal node
1353                 */
1354                BottomType();
1355                /**
1356                 * named type
1357                 */
1358                abstract NamedType(Id name, int lexicalDepth=-2147483648);
1359                    /**
1360                     * a type variable
1361                     * TraitType ::= QualifiedName
1362                     * e.g.) T
1363                     */
1364                    VarType();
1365                    /**
1366                     * a trait (object, alias, or proper trait) type; traits
1367                     * without params are referenced with an empty arg list
1368                     * TraitType ::= QualifiedName [\StaticArgList\]
1369                     * e.g.) List[\ZZ32\]
1370                     */
1371                    TraitType(List<StaticArg> args
1372                               = Collections.<StaticArg>emptyList());
1373                    /**
1374                     * type of a generic singleton, used during static checking
1375                     */
1376                    _RewriteGenericSingletonType(List<StaticParam> staticParams);
1377                /**
1378                 * abbreviated type
1379                 */
1380                abstract AbbreviatedType(Type type);
1381                    /**
1382                     * array type
1383                     * TraitType ::= Type [ ArraySize? ]
1384                     * e.g.) ZZ64[3, 2]
1385                     */
1386                    ArrayType(Indices indices);
1387                    /**
1388                     * matrix type
1389                     * TraitType ::= Type ^ IntExpr
1390                     *             | Type ^ ( ExtentRange (BY ExtentRange)* )
1391                     * e.g.) ZZ32^3
1392                     */
1393                    MatrixType(List<ExtentRange> dimensions);
1394                    /**
1395                     * type with dimension
1396                     * DimType ::= Type DimExpr (in Expr)?
1397                     * e.g.) RR64 Length
1398                     */
1399                    TaggedDimType(DimExpr dim,
1400                                  Option<Expr> unit = Option.<Expr>none());
1401                    /**
1402                     * type with unit
1403                     * DimType ::= Type Expr
1404                     * e.g.) RR64 meter
1405                     */
1406                    TaggedUnitType(Expr unit);
1407            /**
1408             * tuple-like types
1409             */
1410            abstract AbstractTupleType(List<Type> elements);
1411                /**
1412                 * tuple type
1413                 * TupleType ::= ( Type, TypeList )
1414                 * e.g.) (ZZ32, String)
1415                 */
1416                TupleType();
1417                /**
1418                 * Used internally to represent an infinite union of
1419                 * TupleTypes.
1420                 */
1421                VarargTupleType(Type varargs);
1422            /**
1423             * void type
1424             * NonArrowType ::= ()
1425             * e.g.) ()
1426             */
1427            VoidType();
1428            /**
1429             * arrow type
1430             */
1431            abstract AbstractArrowType(Domain domain, Type range,
1432                                       Effect effect = FortressUtil.emptyEffect());
1433                /**
1434                 * arrow type
1435                 * Type ::= Type -> Type Throws?
1436                 * e.g.) (String, NN..., p = Printer) -> NN throws IOException
1437                 */
1438                ArrowType();
1439                /**
1440                 * type of a generic function, used during static checking
1441                 */
1442                _RewriteGenericArrowType(List<StaticParam> staticParams
1443                                          = Collections.<StaticParam>emptyList(),
1444                                         Domain domain,
1445                                         Type range,
1446                                         Effect effect = FortressUtil.emptyEffect(),
1447                                         WhereClause where = FortressUtil.emptyWhereClause());
1448            /**
1449             * inferred type
1450             * Used internally for type analysis
1451             */
1452            _InferenceVarType(Object id);
1453            /**
1454             * An intersection or union.
1455             */
1456            abstract BoundType(List<Type> elements);
1457                /**
1458                 * An intersection.  Used internally for type analysis.
1459                 */
1460                IntersectionType();
1461                /**
1462                 * A union.  Used internally for type analysis.
1463                 */
1464                UnionType();
1465            /**
1466             * Fixed point (a.k.a. "mu") type.  Used internally for type analysis.
1467             * Names must be unqualified.
1468             */
1469            FixedPointType(Id name, Type body);
1470            /**
1471             * The type of the name given to a label expression.  Used internally.
1472             */
1473            LabelType();
1474        /**
1475         * domain of an arrow type
1476         * ArgType ::=
1477         *     ( (Type, )* (Type ... , )? KeywordType(, KeywordType)* )
1478         *   | ( (Type, )* Type ... )
1479         *   | TupleType
1480         * e.g.) ZZ32
1481         * e.g.) (String, ZZ32, String..., foo=ZZ32)
1482         */
1483        Domain(List<Type> args,
1484               Option<Type> varargs = Option.<Type>none(),
1485               List<KeywordType> keywords = Collections.<KeywordType>emptyList())
1486              implements TypeOrDomain;
1487        /**
1488         * effect on arrow types
1489         * e.g.) throws FailCalled
1490         */
1491        Effect(Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(),
1492               boolean io = false);
1493        /**
1494         * static argument
1495         */
1496        abstract StaticArg();
1497            /**
1498             * type used as static argument
1499             * StaticArg ::= Type
1500             * e.g.) List[\ZZ64\]
1501             */
1502            TypeArg(Type type);
1503            /**
1504             * integer used as static argument
1505             * StaticArg ::= IntExpr
1506             * e.g.) m + n
1507             */
1508            IntArg(IntExpr val);
1509            /**
1510             * boolean used as static argument
1511             * StaticArg ::= BoolExpr
1512             * e.g.) ninf OR pinf
1513             */
1514            BoolArg(BoolExpr bool);
1515            /**
1516             * operator used as static argument
1517             * StaticArg ::= Op
1518             * e.g.) +
1519             */
1520            OpArg(Op name);
1521            /**
1522             * dimension used as static argument
1523             * StaticArg ::= Type
1524             * e.g.) Unity
1525             */
1526            DimArg(DimExpr dim);
1527            /**
1528             * unit used as static argument
1529             * StaticArg ::= UnitExpr
1530             * e.g.) dimensionless
1531             */
1532            UnitArg(UnitExpr unit);
1533        /**
1534         * static expression
1535         */
1536        abstract StaticExpr(ignoreForEquals boolean parenthesized = false);
1537            /**
1538             * integer expression
1539             * StaticExpr ::= IntExpr
1540             */
1541            abstract IntExpr();
1542                /**
1543                 * integer value
1544                 * IntExpr ::= IntVal
1545                 */
1546                abstract IntVal();
1547                    /**
1548                     * integer number
1549                     * IntVal ::= IntLiteralExpr
1550                     * e.g.) 8
1551                     */
1552                    NumberConstraint(IntLiteralExpr val);
1553                    /**
1554                     * integer identifier
1555                     * IntVal ::= QualifiedName
1556                     * e.g.) m
1557                     */
1558                    IntRef(Id name);
1559                /**
1560                 * integer expression with an operator
1561                 */
1562                abstract IntOpExpr(IntExpr left, IntExpr right);
1563                    /**
1564                     * integer addition
1565                     * IntExpr ::= IntExpr + IntExpr
1566                     * e.g.) m + 2
1567                     */
1568                    SumConstraint();
1569                    /**
1570                     * integer subtraction
1571                     * IntExpr ::= IntExpr - IntExpr
1572                     * e.g.) m - 2
1573                     */
1574                    MinusConstraint();
1575                    /**
1576                     * integer multiplication
1577                     * IntExpr ::= IntExpr IntExpr
1578                     *           | IntExpr DOT IntExpr
1579                     * e.g.) m DOT n
1580                     */
1581                    ProductConstraint();
1582                    /**
1583                     * integer exponentiation
1584                     * IntExpr ::= IntExpr caret IntVal
1585                     * e.g.) 2^b
1586                     */
1587                    ExponentConstraint();
1588            /**
1589             * boolean expression
1590             * StaticExpr ::= BoolExpr
1591             */
1592            abstract BoolExpr();
1593                /**
1594                 * boolean value
1595                 * BoolExpr ::= BoolVal
1596                 */
1597                abstract BoolVal();
1598                    /**
1599                     * boolean constant
1600                     * BoolVal ::= true | false
1601                     * e.g.) true
1602                     */
1603                    BoolConstant(boolean bool);
1604                    /**
1605                     * boolean identiier
1606                     * BoolVal ::= QualifiedName
1607                     * e.g.) ninf
1608                     */
1609                    BoolRef(Id name);
1610                /**
1611                 * boolean constraint
1612                 * BoolExpr ::= BoolConstraint
1613                 */
1614                abstract BoolConstraint();
1615                    /**
1616                     * boolean NOT constraint
1617                     * BoolConstraint ::= NOT BoolExpr
1618                     * e.g.) NOT ninf
1619                     */
1620                    NotConstraint(BoolExpr bool);
1621                    /**
1622                     * binary boolean constraint
1623                     * e.g.) ninf OR pinf
1624                     */
1625                    abstract BinaryBoolConstraint(BoolExpr left, BoolExpr right);
1626                        /**
1627                         * boolean OR constraint
1628                         * BoolConstraint ::= BoolExpr OR BoolExpr
1629                         * e.g.) ninf OR pinf
1630                         */
1631                        OrConstraint();
1632                        /**
1633                         * boolean AND constraint
1634                         * BoolConstraint ::= BoolExpr AND BoolExpr
1635                         * e.g.) ninf AND pinf
1636                         */
1637                        AndConstraint();
1638                        /**
1639                         * boolean IMPLIES constraint
1640                         * BoolConstraint ::= BoolExpr IMPLIES BoolExpr
1641                         * e.g.) ninf IMPLIES pinf
1642                         */
1643                        ImpliesConstraint();
1644                        /**
1645                         * boolean equality constraint
1646                         * BoolConstraint ::= BoolExpr = BoolExpr
1647                         * e.g.) ninf AND pinf = true
1648                         */
1649                        BEConstraint();
1650            /**
1651             * unit expression
1652             * StaticExpr ::= UnitExpr
1653             */
1654            abstract UnitExpr();
1655                /**
1656                 * unit identifier
1657                 * UnitExpr ::= dimensionless
1658                 *            | QualifiedName
1659                 * e.g.) m
1660                 */
1661                UnitRef(Id name);
1662                /**
1663                 * unit expression with an operator
1664                 */
1665                abstract UnitOpExpr(UnitExpr left, UnitExpr right);
1666                    /**
1667                     * unit multiplication
1668                     * UnitExpr ::= UnitExpr UnitExpr
1669                     *            | UnitExpr DOT UnitExpr
1670                     * e.g.) m DOT n
1671                     */
1672                    ProductUnit();
1673                    /* unit division
1674                     * UnitExpr ::= UnitExpr / UnitExpr
1675                     *            | UnitExpr per UnitExpr
1676                     * e.g.) meter / second
1677                     */
1678                    QuotientUnit();
1679                    /**
1680                     * unit exponentiation
1681                     * UnitExpr ::= UnitExpr caret UnitExpr
1682                     * e.g.) meter^2
1683                     */
1684                    ExponentUnit();
1685        /**
1686         * where clause used in trait, object, and functional declarations
1687         * Where ::= where [\ WhereBindingList \] ({ WhereConstraintList })?
1688         *         | where { WhereConstraintList }
1689         * e.g.) where { ninf AND NOT nan }
1690         */
1691        WhereClause(List<WhereBinding> bindings
1692                        = Collections.<WhereBinding>emptyList(),
1693                    List<WhereConstraint> constraints
1694                        = Collections.<WhereConstraint>emptyList());
1695        /**
1696         * hidden type variable binding declared in where clauses
1697         * Names must be unqualified.
1698         */
1699        abstract WhereBinding(Id name);
1700            /**
1701             * hidden type variable declared in where clauses
1702             * WhereBinding ::= Id Extends?
1703             * Extends ::= extends TraitTypes
1704             * e.g.) T extends Object
1705             */
1706            WhereType(List<BaseType> supers);
1707            /**
1708             * nat parameter declared in where clauses
1709             * WhereBinding ::= nat Id
1710             * e.g.) nat length
1711             */
1712            WhereNat();
1713            /**
1714             * int parameter declared in where clauses
1715             * WhereBinding ::= int Id
1716             * e.g.) int length
1717             */
1718            WhereInt();
1719            /**
1720             * bool parameter declared in where clauses
1721             * WhereBinding ::= bool Id
1722             * e.g.) bool ninf
1723             */
1724            WhereBool();
1725            /**
1726             * unit parameter declared in where clauses
1727             * WhereBinding ::= unit Id
1728             * e.g.) unit U
1729             */
1730            WhereUnit();
1731        /**
1732         * hidden type variable constraint declared in where clauses
1733         */
1734        abstract WhereConstraint();
1735            /**
1736             * type variable constraint declared in where clauses
1737             * WhereConstraint ::= Id Extends
1738             * e.g.) T extends Object
1739             */
1740            WhereExtends(Id name, List<BaseType> supers);
1741            /**
1742             * type alias declaration
1743             * TypeAlias ::= type Id StaticParams? = Type
1744             * e.g.) type IntList = List[\ZZ64\]
1745             */
1746            TypeAlias(Id name,
1747                      List<StaticParam> staticParams
1748                          = Collections.<StaticParam>emptyList(),
1749                      Type type)
1750                     implements Decl, AbsDecl;
1751            /**
1752             * coercion constraint declared in where clauses
1753             * WhereConstraint ::= Type coerces Type
1754             * e.g.) T coerces Identity[\ODOT\]
1755             */
1756            WhereCoerces(Type left, Type right);
1757            /**
1758             * widening constraint declared in where clauses
1759             * WhereConstraint ::= Type widens Type
1760             * e.g.) T widens S
1761             */
1762            WhereWidens(Type left, Type right);
1763            /**
1764             * widening coercion constraint declared in where clauses
1765             * CoercionWhereConstraint ::= Type widens or coerces Type
1766             * e.g.) T widens or coerces S
1767             */
1768            WhereWidensCoerces(Type left, Type right);
1769            /**
1770             * DottedId equality constraint declared in where clauses
1771             * WhereConstraint ::= QualifiedName = QualifiedName
1772             * e.g.) m = n
1773             */
1774            WhereEquals(Id left, Id right);
1775            /**
1776             * unit constraint used in where clauses
1777             * WhereConstraint ::= dimensionless = Id
1778             *               | Id = dimensionless
1779             * e.g.) U = dimensionless
1780             */
1781            UnitConstraint(Id name);
1782            /**
1783             * integer constraint used in where clauses
1784             * WhereConstraint ::= IntConstraint
1785             */
1786            abstract IntConstraint(IntExpr left, IntExpr right);
1787                /**
1788                 * less than equal constraint declared in where clauses
1789                 * IntConstraint ::= IntExpr <= IntExpr
1790                 * e.g.) b <= c
1791                 */
1792                LEConstraint();
1793                /**
1794                 * less than constraint declared in where clauses
1795                 * IntConstraint ::= IntExpr < IntExpr
1796                 * e.g.) 0 < a
1797                 */
1798                LTConstraint();
1799                /**
1800                 * greater than equal constraint declared in where clauses
1801                 * IntConstraint ::= IntExpr >= IntExpr
1802                 * e.g.) b >= c
1803                 */
1804                GEConstraint();
1805                /**
1806                 * greater than constraint declared in where clauses
1807                 * IntConstraint ::= IntExpr > IntExpr
1808                 * e.g.) a > 0
1809                 */
1810                GTConstraint();
1811                /**
1812                 * integer equality constraint declared in where clauses
1813                 * IntConstraint ::= IntExpr = IntExpr
1814                 * e.g.) 8 = 2^3
1815                 */
1816                IEConstraint();
1817            /**
1818             * boolean constraint declared in where clauses
1819             * WhereConstraint ::= BoolConstraint
1820             * e.g.) pinf AND ninf
1821             */
1822            BoolConstraintExpr(BoolConstraint constraint);
1823        /**
1824         * contracts used in functional declarations and object declarations
1825         * Contract ::= Requires? Ensures? Invariant?
1826         * Requires ::= requires { ExprList? }
1827         * Ensures ::= ensures { EnsuresClauseList? }
1828         * Invariant ::= invariant { ExprList? }
1829         * CoercionContract ::= Ensures? Invariant?
1830         * e.g.) requires { n GE 0 } ensures { result GE 0 }
1831         */
1832        Contract(Option<List<Expr>> requires = Option.<List<Expr>>none(),
1833                 Option<List<EnsuresClause>> ensures =
1834                     Option.<List<EnsuresClause>>none(),
1835                 Option<List<Expr>> invariants = Option.<List<Expr>>none());
1836        /**
1837         * ensures clause used in contracts
1838         * EnsuresClause ::= Expr (provided Expr)?
1839         * e.g.) sorted(result) provided sorted(input)
1840         */
1841        EnsuresClause(Expr post, Option<Expr> pre = Option.<Expr>none());
1842        /**
1843         * modifier
1844         * TraitMod      ::= AbsTraitMod | private
1845         * AbsTraitMod   ::= value | test
1846         * ObjectMods    ::= TraitMods
1847         * AbsObjectMods ::= AbsTraitMods
1848         * MdMod         ::= FnMod | override
1849         * AbsMdMod      ::= AbsFnMod | override
1850         * FnMod         ::= AbsFnMod | private
1851         * AbsFnMod      ::= LocalFnMod | test
1852         * LocalFnMod    ::= atomic | io
1853         * ParamFldMod   ::= var | hidden | settable | wrapped
1854         * VarMod        ::= AbsVarMod | private
1855         * AbsVarMod     ::= var | test
1856         * FldMod        ::= var | AbsFldMod
1857         * AbsFldMod     ::= ApiFldMod | wrapped | private
1858         * ApiFldMod     ::= hidden | settable | test
1859         */
1860        abstract Modifier();
1861            /**
1862             * e.g.) abstract m(x: ZZ32): ()
1863             */
1864            ModifierAbstract();
1865            /**
1866             * e.g.) atomic f(x: ZZ32): ()
1867             */
1868            ModifierAtomic();
1869            /**
1870             * e.g.) getter velocity(): (RR Velocity)^3
1871             */
1872            ModifierGetter();
1873            /**
1874             * e.g.) hidden x: ZZ32
1875             */
1876            ModifierHidden();
1877            /**
1878             * e.g.) io print(s: String): ()
1879             */
1880            ModifierIO();
1881            /**
1882             * e.g.) override m(x: ZZ32): ()
1883             */
1884            ModifierOverride();
1885            /**
1886             * e.g.) private f(): ()
1887             */
1888            ModifierPrivate();
1889            /**
1890             * e.g.) settable message: Maybe[\String\]
1891             */
1892            ModifierSettable();
1893            /**
1894             * e.g.) setter velocity(v: (RR Velocity)^3): ()
1895             */
1896            ModifierSetter();
1897            /**
1898             * e.g.) test object TestSuite(testFunctions = {}) end
1899             */
1900            ModifierTest();
1901            /**
1902             * e.g.) object O(transient x: ZZ32) end
1903             */
1904            ModifierTransient();
1905            /**
1906             * e.g.) value object IntEmpty extends List[\ZZ32\] end
1907             */
1908            ModifierValue();
1909            /**
1910             * e.g.) var x: ZZ32
1911             */
1912            ModifierVar();
1913            /**
1914             * e.g.) coerce (x: RR32) widens = ...
1915             */
1916            ModifierWidens();
1917            /**
1918             * e.g.) wrapped val: Dictionary[\T\]
1919             */
1920            ModifierWrapped();
1921        /**
1922         * static parameter
1923         */
1924        abstract StaticParam();
1925            /**
1926             * operator parameter
1927             * StaticParam ::= opr Op
1928             * e.g.) opr ODOT
1929             */
1930            OpParam(Op name);
1931            /**
1932             * static parameter with a name field of type Id
1933             * Names must be unqualified.
1934             */
1935            abstract IdStaticParam(Id name);
1936               /**
1937                * bool parameter
1938                * StaticParam ::= bool Id
1939                * e.g.) bool nan
1940                */
1941                BoolParam();
1942               /**
1943                * dimension parameter
1944                * StaticParam ::= dim Id
1945                * e.g.) dim D
1946                */
1947                DimParam();
1948               /**
1949                * int parameter
1950                * StaticParam ::= int Id
1951                * e.g.) int i
1952                */
1953                IntParam();
1954               /**
1955                * nat parameter
1956                * StaticParam ::= nat Id
1957                * e.g.) nat len
1958                */
1959                NatParam();
1960               /**
1961                * type parameter
1962                * StaticParam ::= Id Extends? (absorbs unit)?
1963                * e.g.) EltType extends Number absorbs unit
1964                */
1965                TypeParam(List<BaseType> extendsClause =
1966                              Collections.<BaseType>emptyList(),
1967                          boolean absorbs = false);
1968               /**
1969                * unit parameter
1970                * StaticParam ::= unit Id (: Type)? (absorbs unit)?
1971                * e.g.) unit U absrbs unit
1972                */
1973                UnitParam(Option<Type> dim = Option.<Type>none(),
1974                          boolean absorbs = false);
1975        /**
1976         * name used in declarations and references
1977         */
1978        abstract Name();
1979            /**
1980             * Template gap for names
1981             */
1982            TemplateGapName(Id id, List<Id> templateParams) implements TemplateGap;
1983            /**
1984             * unstructured sequence of ids naming an API or component
1985             * Names in the list must be unqualified.
1986             * APIName ::= Id(.Id)*
1987             * e.g.) com.sun.fortress.nodes_util
1988             *
1989             */
1990            APIName(List<Id> ids,
1991                    ignoreForEquals String text = com.sun.fortress.useful.Useful.<Id>dottedList(in_ids).intern());
1992            /**
1993             * non-API name
1994             * SimpleName ::= Id
1995             *              | opr Op
1996             *              | opr EncloserPair
1997             */
1998            abstract IdOrOpOrAnonymousName(Option<APIName> api
1999                                               = Option.<APIName>none());
2000                /**
2001                 * identifier or operator name
2002                 */
2003                abstract IdOrOpName();
2004                    /**
2005                     * identifier name
2006                     * e.g.) hashCode
2007                     */
2008                    Id(String text);
2009                        /**
2010                         * Template gap for expressions
2011                         */
2012                        TemplateGapId(Id id, List<Id> templateParams) implements TemplateGap;
2013                    /**
2014                     * operator name
2015                     */
2016                    abstract OpName();
2017                        /**
2018                         * non-enclosing operator
2019                         * e.g.) COMPOSE
2020                         * e.g.) ===
2021                         */
2022                        Op(String text,
2023                           Option<Fixity> fixity = Option.<Fixity>none());
2024                        /**
2025                         * pair of enclosing operators
2026                         * Opening and closing Ops must be unqualified.
2027                         * EncloserPair ::= (LeftEncloser | Encloser)
2028                         *                    (RightEncloser | Encloser)
2029                         * e.g.) </ />
2030                         */
2031                        Enclosing(Op open, Op close);
2032                /**
2033                 * anonymous name; used internally
2034                 */
2035                abstract AnonymousName();
2036                    /**
2037                     * internal name for anonymous function expressions
2038                     * not created during parsing but during evaluation
2039                     * e.g.) name for "fn x => x + 1"
2040                     */
2041                    AnonymousFnName();
2042                    /**
2043                     * internal name for anonymous constructor expressions
2044                     * not created during parsing but during evaluation
2045                     * e.g.) name for "object extends List cons(x) = Cons(x, self) end"
2046                     */
2047                    ConstructorFnName(GenericWithParams def);
2048        /**
2049         * array comprehension clause
2050         * ArrayComprehensionClause ::= ArrayComprehensionLeft | GeneratorClauseList
2051         * ArrayComprehensionLeft ::= IdOrInt |-> Expr
2052         *                          | ( IdOrInt, IdOrIntList ) |-> Expr
2053         * IdOrInt ::= Id
2054         *           | IntLiteralExpr
2055         * e.g.) (x, y) = 0 | x <- {0, 1, 2}, y <- {0, 1, 2}
2056         */
2057        ArrayComprehensionClause(List<Expr> bind, Expr init,
2058                                 List<GeneratorClause> gens);
2059        /**
2060         * keyword expression used in argument expressions
2061         * Names must be unqualified.
2062         * KeywordExpr ::= BindId = Expr
2063         * e.g.) x = myLoser.myField
2064         */
2065        KeywordExpr(Id name, Expr init);
2066        /**
2067         * case clause used in case expressions and extremum expressions
2068         * CaseClause ::= Expr => BlockElems
2069         * e.g.) { Jupiter, Saturn, Uranus, Neptune } => "outer"
2070         */
2071        CaseClause(Expr match, Block body);
2072        /**
2073         * catch clause used in try expressions
2074         * Names must be unqualified.
2075         * Catch ::= catch BindId CatchClauses
2076         * e.g.) catch e IOException => throw ForbiddenException(e)
2077         */
2078        Catch(Id name, List<CatchClause> clauses);
2079        /**
2080         * each clause in a catch clause used in try expressions
2081         * CatchClause ::= TraitType => BlockElems
2082         * e.g.) IOException => throw ForbiddenException(e)
2083         */
2084        CatchClause(BaseType match, Block body);
2085        /**
2086         * block expression used in do expressions
2087         * DoFront ::= (at Expr)? atomic? do BlockElems?
2088         * e.g.) at a.region(j) do w := a_j
2089         */
2090        DoFront(Option<Expr> loc = Option.<Expr>none(), boolean atomic = false,
2091                Block expr);
2092        /**
2093         * if clause used in if expressions
2094         * DelimitedExpr ::= if Expr then BlockElems Elifs? Else? end
2095         * Elif ::= elif Expr then BlockElems
2096         * e.g.) if x IN { 0, 1, 2 } then 0
2097         */
2098        IfClause(GeneratorClause test, Block body);
2099        /**
2100         * typecase clause used in typecase expressions
2101         * TypecaseClause ::= TypecaseTypes => BlockElems
2102         * TypecaseTypes ::= ( TypeList )
2103         *                 | Type
2104         * e.g.) String => x.append("foo")
2105         */
2106        TypecaseClause(List<Type> match, Block body);
2107        /**
2108         * array and matrix size
2109         * ExtentRange ::= StaticArg? # StaticArg?
2110         *               | StaticArg? : StaticArg?
2111         *               | StaticArg
2112         * e.g.) 3#5
2113         */
2114        ExtentRange(Option<StaticArg> base, Option<StaticArg> size);
2115        /**
2116         * generator
2117         * Names must be unqualified.
2118         * GeneratorClauseList ::= GeneratorBinding (, GeneratorClause)*
2119         * GeneratorBinding ::= BindIdOrBindIdTuple <- Expr
2120         * GeneratorClause ::= GeneratorBinding
2121         *                   | Expr
2122         * e.g.) (i, j) <- my2DArray.indices
2123         */
2124        GeneratorClause(List<Id> bind, Expr init);
2125        /**
2126         * varargs expression used in tuple expressions
2127         * Expr...
2128         * e.g.) [3 4 5]...
2129         */
2130        VarargsExpr(Expr varargs);
2131        /**
2132         * keyword type used in tuple types
2133         * Names must be unqualified.
2134         * KeywordType ::= BindId = Type
2135         * e.g.) x = String
2136         */
2137        KeywordType(Id name, Type type);
2138        /**
2139         * trait type with a where clause used in extends clauses
2140         * TraitTypeWhere ::= TraitType Where?
2141         * e.g.) T[\ninf, nan\] where { ninf AND NOT nan }
2142         */
2143        TraitTypeWhere(BaseType type, WhereClause where);
2144        /**
2145         * array dimensionality
2146         * ArraySize ::= ExtentRange(, ExtentRange)*
2147         * e.g.) 3, 2#1, 3:5
2148         */
2149        Indices(List<ExtentRange> extents);
2150        /**
2151         * mathematical item
2152         */
2153        abstract MathItem();
2154            /**
2155             * mathematical item that is an expression element
2156             */
2157            abstract ExprMI(Expr expr);
2158                /**
2159                 * mathematical item that is a parenthesis delimited expression
2160                 * MathItem ::= ParenthesisDelimited
2161                 * e.g.) ( 3 + 4 )
2162                 */
2163                ParenthesisDelimitedMI();
2164                /**
2165                 * mathematical item that is not a parenthesis delimited expression
2166                 * MathItem ::= VarOrFnRef
2167                 *            | LiteralExpr
2168                 *            | self
2169                 * e.g.) self
2170                 */
2171                NonParenthesisDelimitedMI();
2172            /**
2173             * mathematical item that is a non-expression element
2174             */
2175            abstract NonExprMI();
2176                /**
2177                 * mathematical item that is an exponentiation
2178                 * MathItem ::= Exponentiation
2179                 * e.g.) ^3
2180                 */
2181                ExponentiationMI(OpRef op, Option<Expr> expr);
2182                /**
2183                 * mathematical item that is a subscripting
2184                 * MathItem ::= Subscripting
2185                 * e.g.) [3, 4]
2186                 */
2187                SubscriptingMI(Enclosing op, List<Expr> exprs,
2188                               List<StaticArg> staticArgs);
2189        /**
2190         * operator fixity
2191         */
2192        abstract Fixity();
2193            /**
2194             * e.g.) 3 + 5
2195             */
2196            InFixity();
2197            /**
2198             * e.g.) -5
2199             */
2200            PreFixity();
2201            /**
2202             * e.g.) 3!
2203             */
2204            PostFixity();
2205            /**
2206             * e.g.) :
2207             */
2208            NoFixity();
2209            /**
2210             * e.g.) S1 BY S2 BY S3
2211             */
2212            MultiFixity();
2213            /**
2214             * left encloser or right encloser
2215             * e.g.) <|
2216             */
2217            EnclosingFixity();
2218            /**
2219             * BIG operator
2220             * e.g.) SUM
2221             */
2222            BigFixity();
2223        /*
2224         * A Link in a ChainExpr is a pair of OpRef and the next Expr in the chain.
2225         * e.g.) < 5
2226         */
2227        Link(OpRef op, Expr expr);
2228
2229    end;
Note: See TracBrowser for help on using the browser.