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

Revision 2390, 88.1 KB (checked in by sukyoungryu, 16 months ago)

[tool] ast->concrete, more nodes

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