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

Revision 2405, 88.2 KB (checked in by sukyoungryu, 16 months ago)

[tool] Fixed arrays and also do.

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,
1266                                      List<ArrayExpr> elements,
1267                                      boolean outermost = false);
1268        /**
1269         * type
1270         */
1271        root abstract Type(ignoreForEquals boolean parenthesized = false)
1272                      implements TypeOrDomain;
1273            /**
1274             * dimension expression (not really a type, but here for
1275             * now because of the way the parser is defined)
1276             */
1277            abstract DimExpr();
1278                /* vector type or exponent dimemsion
1279                 * resolved during parsing
1280                 * e.g.) ZZ32^3
1281                 * e.g.) Time^2
1282                 */
1283                ExponentType(Type base, IntExpr power);
1284                /* base dimension
1285                 * DimExpr ::= Unity
1286                 * e.g.) Unity
1287                 */
1288                BaseDim();
1289                /* dimension identifier
1290                 * DimExpr ::= QualifiedName
1291                 * e.g.) com.sun.fortress.dim.Length
1292                 */
1293                DimRef(Id name);
1294                /* dimension multiplication
1295                 * DimExpr ::= DimExpr DOT DimExpr
1296                 *           | DimExpr DimExpr
1297                 * e.g.) Length Mass
1298                 */
1299                ProductDim(DimExpr multiplier, DimExpr multiplicand);
1300                /* dimension division
1301                 * DimExpr ::= DimExpr / DimExpr
1302                 *           | DimExpr per DimExpr
1303                 *           | 1 / DimExpr
1304                 * e.g.) Length / Time
1305                 */
1306                QuotientDim(DimExpr numerator, DimExpr denominator);
1307                /* dimension exponentiation
1308                 * DimExpr ::= DimExpr ^ IntExpr
1309                 * e.g.) Time^2
1310                 */
1311                ExponentDim(DimExpr base, IntExpr power);
1312                /* dimension with operator
1313                 * DimExpr ::= DimPrefixOp DimExpr
1314                 *           | DimExpr DimPostfixOp
1315                 * e.g.) Time squared
1316                 */
1317                OpDim(DimExpr val, Op op);
1318            /**
1319             * base types: things that can be extended, excluded, thrown, etc.
1320             */
1321            abstract BaseType();
1322                /**
1323                 * any type
1324                 * e.g.) Any
1325                 */
1326                AnyType();
1327                /**
1328                 * bottom type
1329                 * internal node
1330                 */
1331                BottomType();
1332                /**
1333                 * named type
1334                 */
1335                abstract NamedType(Id name, int lexicalDepth=-2147483648);
1336                    /**
1337                     * a type variable
1338                     * TraitType ::= QualifiedName
1339                     * e.g.) T
1340                     */
1341                    VarType();
1342                    /**
1343                     * a trait (object, alias, or proper trait) type; traits
1344                     * without params are referenced with an empty arg list
1345                     * TraitType ::= QualifiedName [\StaticArgList\]
1346                     * e.g.) List[\ZZ32\]
1347                     */
1348                    TraitType(List<StaticArg> args
1349                               = Collections.<StaticArg>emptyList());
1350                    /**
1351                     * type of a generic singleton, used during static checking
1352                     */
1353                    _RewriteGenericSingletonType(List<StaticParam> staticParams);
1354                /**
1355                 * abbreviated type
1356                 */
1357                abstract AbbreviatedType(Type type);
1358                    /**
1359                     * array type
1360                     * TraitType ::= Type [ ArraySize? ]
1361                     * e.g.) ZZ64[3, 2]
1362                     */
1363                    ArrayType(Indices indices);
1364                    /**
1365                     * matrix type
1366                     * TraitType ::= Type ^ IntExpr
1367                     *             | Type ^ ( ExtentRange (BY ExtentRange)* )
1368                     * e.g.) ZZ32^3
1369                     */
1370                    MatrixType(List<ExtentRange> dimensions);
1371                    /**
1372                     * type with dimension
1373                     * DimType ::= Type DimExpr (in Expr)?
1374                     * e.g.) RR64 Length
1375                     */
1376                    TaggedDimType(DimExpr dim,
1377                                  Option<Expr> unit = Option.<Expr>none());
1378                    /**
1379                     * type with unit
1380                     * DimType ::= Type Expr
1381                     * e.g.) RR64 meter
1382                     */
1383                    TaggedUnitType(Expr unit);
1384            /**
1385             * tuple-like types
1386             */
1387            abstract AbstractTupleType(List<Type> elements);
1388                /**
1389                 * tuple type
1390                 * TupleType ::= ( Type, TypeList )
1391                 * e.g.) (ZZ32, String)
1392                 */
1393                TupleType();
1394                /**
1395                 * Used internally to represent an infinite union of
1396                 * TupleTypes.
1397                 */
1398                VarargTupleType(Type varargs);
1399            /**
1400             * void type
1401             * NonArrowType ::= ()
1402             * e.g.) ()
1403             */
1404            VoidType();
1405            /**
1406             * arrow type
1407             */
1408            abstract AbstractArrowType(Domain domain, Type range,
1409                                       Effect effect = FortressUtil.emptyEffect());
1410                /**
1411                 * arrow type
1412                 * Type ::= Type -> Type Throws?
1413                 * e.g.) (String, NN..., p = Printer) -> NN throws IOException
1414                 */
1415                ArrowType();
1416                /**
1417                 * type of a generic function, used during static checking
1418                 */
1419                _RewriteGenericArrowType(List<StaticParam> staticParams
1420                                          = Collections.<StaticParam>emptyList(),
1421                                         Domain domain,
1422                                         Type range,
1423                                         Effect effect = FortressUtil.emptyEffect(),
1424                                         WhereClause where = FortressUtil.emptyWhereClause());
1425            /**
1426             * inferred type
1427             * Used internally for type analysis
1428             */
1429            _InferenceVarType(Object id);
1430            /**
1431             * An intersection or union.
1432             */
1433            abstract BoundType(List<Type> elements);
1434                /**
1435                 * An intersection.  Used internally for type analysis.
1436                 */
1437                IntersectionType();
1438                /**
1439                 * A union.  Used internally for type analysis.
1440                 */
1441                UnionType();
1442            /**
1443             * Fixed point (a.k.a. "mu") type.  Used internally for type analysis.
1444             * Names must be unqualified.
1445             */
1446            FixedPointType(Id name, Type body);
1447            /**
1448             * The type of the name given to a label expression.  Used internally.
1449             */
1450            LabelType();
1451        /**
1452         * domain of an arrow type
1453         * ArgType ::=
1454         *     ( (Type, )* (Type ... , )? KeywordType(, KeywordType)* )
1455         *   | ( (Type, )* Type ... )
1456         *   | TupleType
1457         * e.g.) ZZ32
1458         * e.g.) (String, ZZ32, String..., foo=ZZ32)
1459         */
1460        Domain(List<Type> args,
1461               Option<Type> varargs = Option.<Type>none(),
1462               List<KeywordType> keywords = Collections.<KeywordType>emptyList())
1463              implements TypeOrDomain;
1464        /**
1465         * effect on arrow types
1466         * e.g.) throws FailCalled
1467         */
1468        Effect(Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(),
1469               boolean io = false);
1470        /**
1471         * static argument
1472         */
1473        root abstract StaticArg();
1474            /**
1475             * type used as static argument
1476             * StaticArg ::= Type
1477             * e.g.) List[\ZZ64\]
1478             */
1479            TypeArg(Type type);
1480            /**
1481             * integer used as static argument
1482             * StaticArg ::= IntExpr
1483             * e.g.) m + n
1484             */
1485            IntArg(IntExpr val);
1486            /**
1487             * boolean used as static argument
1488             * StaticArg ::= BoolExpr
1489             * e.g.) ninf OR pinf
1490             */
1491            BoolArg(BoolExpr bool);
1492            /**
1493             * operator used as static argument
1494             * StaticArg ::= Op
1495             * e.g.) +
1496             */
1497            OpArg(Op name);
1498            /**
1499             * dimension used as static argument
1500             * StaticArg ::= Type
1501             * e.g.) Unity
1502             */
1503            DimArg(DimExpr dim);
1504            /**
1505             * unit used as static argument
1506             * StaticArg ::= UnitExpr
1507             * e.g.) dimensionless
1508             */
1509            UnitArg(UnitExpr unit);
1510        /**
1511         * static expression
1512         */
1513        abstract StaticExpr(ignoreForEquals boolean parenthesized = false);
1514            /**
1515             * integer expression
1516             * StaticExpr ::= IntExpr
1517             */
1518            abstract IntExpr();
1519                /**
1520                 * integer value
1521                 * IntExpr ::= IntVal
1522                 */
1523                abstract IntVal();
1524                    /**
1525                     * integer number
1526                     * IntVal ::= IntLiteralExpr
1527                     * e.g.) 8
1528                     */
1529                    NumberConstraint(IntLiteralExpr val);
1530                    /**
1531                     * integer identifier
1532                     * IntVal ::= QualifiedName
1533                     * e.g.) m
1534                     */
1535                    IntRef(Id name);
1536                /**
1537                 * integer expression with an operator
1538                 */
1539                abstract IntOpExpr(IntExpr left, IntExpr right);
1540                    /**
1541                     * integer addition
1542                     * IntExpr ::= IntExpr + IntExpr
1543                     * e.g.) m + 2
1544                     */
1545                    SumConstraint();
1546                    /**
1547                     * integer subtraction
1548                     * IntExpr ::= IntExpr - IntExpr
1549                     * e.g.) m - 2
1550                     */
1551                    MinusConstraint();
1552                    /**
1553                     * integer multiplication
1554                     * IntExpr ::= IntExpr IntExpr
1555                     *           | IntExpr DOT IntExpr
1556                     * e.g.) m DOT n
1557                     */
1558                    ProductConstraint();
1559                    /**
1560                     * integer exponentiation
1561                     * IntExpr ::= IntExpr caret IntVal
1562                     * e.g.) 2^b
1563                     */
1564                    ExponentConstraint();
1565            /**
1566             * boolean expression
1567             * StaticExpr ::= BoolExpr
1568             */
1569            abstract BoolExpr();
1570                /**
1571                 * boolean value
1572                 * BoolExpr ::= BoolVal
1573                 */
1574                abstract BoolVal();
1575                    /**
1576                     * boolean constant
1577                     * BoolVal ::= true | false
1578                     * e.g.) true
1579                     */
1580                    BoolConstant(boolean bool);
1581                    /**
1582                     * boolean identiier
1583                     * BoolVal ::= QualifiedName
1584                     * e.g.) ninf
1585                     */
1586                    BoolRef(Id name);
1587                /**
1588                 * boolean constraint
1589                 * BoolExpr ::= BoolConstraint
1590                 */
1591                abstract BoolConstraint();
1592                    /**
1593                     * boolean NOT constraint
1594                     * BoolConstraint ::= NOT BoolExpr
1595                     * e.g.) NOT ninf
1596                     */
1597                    NotConstraint(BoolExpr bool);
1598                    /**
1599                     * binary boolean constraint
1600                     * e.g.) ninf OR pinf
1601                     */
1602                    abstract BinaryBoolConstraint(BoolExpr left, BoolExpr right);
1603                        /**
1604                         * boolean OR constraint
1605                         * BoolConstraint ::= BoolExpr OR BoolExpr
1606                         * e.g.) ninf OR pinf
1607                         */
1608                        OrConstraint();
1609                        /**
1610                         * boolean AND constraint
1611                         * BoolConstraint ::= BoolExpr AND BoolExpr
1612                         * e.g.) ninf AND pinf
1613                         */
1614                        AndConstraint();
1615                        /**
1616                         * boolean IMPLIES constraint
1617                         * BoolConstraint ::= BoolExpr IMPLIES BoolExpr
1618                         * e.g.) ninf IMPLIES pinf
1619                         */
1620                        ImpliesConstraint();
1621                        /**
1622                         * boolean equality constraint
1623                         * BoolConstraint ::= BoolExpr = BoolExpr
1624                         * e.g.) ninf AND pinf = true
1625                         */
1626                        BEConstraint();
1627            /**
1628             * unit expression
1629             * StaticExpr ::= UnitExpr
1630             */
1631            abstract UnitExpr();
1632                /**
1633                 * unit identifier
1634                 * UnitExpr ::= dimensionless
1635                 *            | QualifiedName
1636                 * e.g.) m
1637                 */
1638                UnitRef(Id name);
1639                /**
1640                 * unit expression with an operator
1641                 */
1642                abstract UnitOpExpr(UnitExpr left, UnitExpr right);
1643                    /**
1644                     * unit multiplication
1645                     * UnitExpr ::= UnitExpr UnitExpr
1646                     *            | UnitExpr DOT UnitExpr
1647                     * e.g.) m DOT n
1648                     */
1649                    ProductUnit();
1650                    /* unit division
1651                     * UnitExpr ::= UnitExpr / UnitExpr
1652                     *            | UnitExpr per UnitExpr
1653                     * e.g.) meter / second
1654                     */
1655                    QuotientUnit();
1656                    /**
1657                     * unit exponentiation
1658                     * UnitExpr ::= UnitExpr caret UnitExpr
1659                     * e.g.) meter^2
1660                     */
1661                    ExponentUnit();
1662        /**
1663         * where clause used in trait, object, and functional declarations
1664         * Where ::= where [\ WhereBindingList \] ({ WhereConstraintList })?
1665         *         | where { WhereConstraintList }
1666         * e.g.) where { ninf AND NOT nan }
1667         */
1668        WhereClause(List<WhereBinding> bindings
1669                        = Collections.<WhereBinding>emptyList(),
1670                    List<WhereConstraint> constraints
1671                        = Collections.<WhereConstraint>emptyList());
1672        /**
1673         * hidden type variable binding declared in where clauses
1674         * Names must be unqualified.
1675         */
1676        abstract WhereBinding(Id name);
1677            /**
1678             * hidden type variable declared in where clauses
1679             * WhereBinding ::= Id Extends?
1680             * Extends ::= extends TraitTypes
1681             * e.g.) T extends Object
1682             */
1683            WhereType(List<BaseType> supers);
1684            /**
1685             * nat parameter declared in where clauses
1686             * WhereBinding ::= nat Id
1687             * e.g.) nat length
1688             */
1689            WhereNat();
1690            /**
1691             * int parameter declared in where clauses
1692             * WhereBinding ::= int Id
1693             * e.g.) int length
1694             */
1695            WhereInt();
1696            /**
1697             * bool parameter declared in where clauses
1698             * WhereBinding ::= bool Id
1699             * e.g.) bool ninf
1700             */
1701            WhereBool();
1702            /**
1703             * unit parameter declared in where clauses
1704             * WhereBinding ::= unit Id
1705             * e.g.) unit U
1706             */
1707            WhereUnit();
1708        /**
1709         * hidden type variable constraint declared in where clauses
1710         */
1711        abstract WhereConstraint();
1712            /**
1713             * type variable constraint declared in where clauses
1714             * WhereConstraint ::= Id Extends
1715             * e.g.) T extends Object
1716             */
1717            WhereExtends(Id name, List<BaseType> supers);
1718            /**
1719             * type alias declaration
1720             * TypeAlias ::= type Id StaticParams? = Type
1721             * e.g.) type IntList = List[\ZZ64\]
1722             */
1723            TypeAlias(Id name,
1724                      List<StaticParam> staticParams
1725                          = Collections.<StaticParam>emptyList(),
1726                      Type type)
1727                     implements Decl, AbsDecl;
1728            /**
1729             * coercion constraint declared in where clauses
1730             * WhereConstraint ::= Type coerces Type
1731             * e.g.) T coerces Identity[\ODOT\]
1732             */
1733            WhereCoerces(Type left, Type right);
1734            /**
1735             * widening constraint declared in where clauses
1736             * WhereConstraint ::= Type widens Type
1737             * e.g.) T widens S
1738             */
1739            WhereWidens(Type left, Type right);
1740            /**
1741             * widening coercion constraint declared in where clauses
1742             * CoercionWhereConstraint ::= Type widens or coerces Type
1743             * e.g.) T widens or coerces S
1744             */
1745            WhereWidensCoerces(Type left, Type right);
1746            /**
1747             * DottedId equality constraint declared in where clauses
1748             * WhereConstraint ::= QualifiedName = QualifiedName
1749             * e.g.) m = n
1750             */
1751            WhereEquals(Id left, Id right);
1752            /**
1753             * unit constraint used in where clauses
1754             * WhereConstraint ::= dimensionless = Id
1755             *               | Id = dimensionless
1756             * e.g.) U = dimensionless
1757             */
1758            UnitConstraint(Id name);
1759            /**
1760             * integer constraint used in where clauses
1761             * WhereConstraint ::= IntConstraint
1762             */
1763            abstract IntConstraint(IntExpr left, IntExpr right);
1764                /**
1765                 * less than equal constraint declared in where clauses
1766                 * IntConstraint ::= IntExpr <= IntExpr
1767                 * e.g.) b <= c
1768                 */
1769                LEConstraint();
1770                /**
1771                 * less than constraint declared in where clauses
1772                 * IntConstraint ::= IntExpr < IntExpr
1773                 * e.g.) 0 < a
1774                 */
1775                LTConstraint();
1776                /**
1777                 * greater than equal constraint declared in where clauses
1778                 * IntConstraint ::= IntExpr >= IntExpr
1779                 * e.g.) b >= c
1780                 */
1781                GEConstraint();
1782                /**
1783                 * greater than constraint declared in where clauses
1784                 * IntConstraint ::= IntExpr > IntExpr
1785                 * e.g.) a > 0
1786                 */
1787                GTConstraint();
1788                /**
1789                 * integer equality constraint declared in where clauses
1790                 * IntConstraint ::= IntExpr = IntExpr
1791                 * e.g.) 8 = 2^3
1792                 */
1793                IEConstraint();
1794            /**
1795             * boolean constraint declared in where clauses
1796             * WhereConstraint ::= BoolConstraint
1797             * e.g.) pinf AND ninf
1798             */
1799            BoolConstraintExpr(BoolConstraint constraint);
1800        /**
1801         * contracts used in functional declarations and object declarations
1802         * Contract ::= Requires? Ensures? Invariant?
1803         * Requires ::= requires { ExprList? }
1804         * Ensures ::= ensures { EnsuresClauseList? }
1805         * Invariant ::= invariant { ExprList? }
1806         * CoercionContract ::= Ensures? Invariant?
1807         * e.g.) requires { n GE 0 } ensures { result GE 0 }
1808         */
1809        Contract(Option<List<Expr>> requires = Option.<List<Expr>>none(),
1810                 Option<List<EnsuresClause>> ensures =
1811                     Option.<List<EnsuresClause>>none(),
1812                 Option<List<Expr>> invariants = Option.<List<Expr>>none());
1813        /**
1814         * ensures clause used in contracts
1815         * EnsuresClause ::= Expr (provided Expr)?
1816         * e.g.) sorted(result) provided sorted(input)
1817         */
1818        EnsuresClause(Expr post, Option<Expr> pre = Option.<Expr>none());
1819        /**
1820         * modifier
1821         * TraitMod      ::= AbsTraitMod | private
1822         * AbsTraitMod   ::= value | test
1823         * ObjectMods    ::= TraitMods
1824         * AbsObjectMods ::= AbsTraitMods
1825         * MdMod         ::= FnMod | override
1826         * AbsMdMod      ::= AbsFnMod | override
1827         * FnMod         ::= AbsFnMod | private
1828         * AbsFnMod      ::= LocalFnMod | test
1829         * LocalFnMod    ::= atomic | io
1830         * ParamFldMod   ::= var | hidden | settable | wrapped
1831         * VarMod        ::= AbsVarMod | private
1832         * AbsVarMod     ::= var | test
1833         * FldMod        ::= var | AbsFldMod
1834         * AbsFldMod     ::= ApiFldMod | wrapped | private
1835         * ApiFldMod     ::= hidden | settable | test
1836         */
1837        abstract Modifier();
1838            /**
1839             * e.g.) abstract m(x: ZZ32): ()
1840             */
1841            ModifierAbstract();
1842            /**
1843             * e.g.) atomic f(x: ZZ32): ()
1844             */
1845            ModifierAtomic();
1846            /**
1847             * e.g.) getter velocity(): (RR Velocity)^3
1848             */
1849            ModifierGetter();
1850            /**
1851             * e.g.) hidden x: ZZ32
1852             */
1853            ModifierHidden();
1854            /**
1855             * e.g.) io print(s: String): ()
1856             */
1857            ModifierIO();
1858            /**
1859             * e.g.) override m(x: ZZ32): ()
1860             */
1861            ModifierOverride();
1862            /**
1863             * e.g.) private f(): ()
1864             */
1865            ModifierPrivate();
1866            /**
1867             * e.g.) settable message: Maybe[\String\]
1868             */
1869            ModifierSettable();
1870            /**
1871             * e.g.) setter velocity(v: (RR Velocity)^3): ()
1872             */
1873            ModifierSetter();
1874            /**
1875             * e.g.) test object TestSuite(testFunctions = {}) end
1876             */
1877            ModifierTest();
1878            /**
1879             * e.g.) object O(transient x: ZZ32) end
1880             */
1881            ModifierTransient();
1882            /**
1883             * e.g.) value object IntEmpty extends List[\ZZ32\] end
1884             */
1885            ModifierValue();
1886            /**
1887             * e.g.) var x: ZZ32
1888             */
1889            ModifierVar();
1890            /**
1891             * e.g.) coerce (x: RR32) widens = ...
1892             */
1893            ModifierWidens();
1894            /**
1895             * e.g.) wrapped val: Dictionary[\T\]
1896             */
1897            ModifierWrapped();
1898        /**
1899         * static parameter
1900         */
1901        abstract StaticParam();
1902            /**
1903             * operator parameter
1904             * StaticParam ::= opr Op
1905             * e.g.) opr ODOT
1906             */
1907            OpParam(Op name);
1908            /**
1909             * static parameter with a name field of type Id
1910             * Names must be unqualified.
1911             */
1912            abstract IdStaticParam(Id name);
1913               /**
1914                * bool parameter
1915                * StaticParam ::= bool Id
1916                * e.g.) bool nan
1917                */
1918                BoolParam();
1919               /**
1920                * dimension parameter
1921                * StaticParam ::= dim Id
1922                * e.g.) dim D
1923                */
1924                DimParam();
1925               /**
1926                * int parameter
1927                * StaticParam ::= int Id
1928                * e.g.) int i
1929                */
1930                IntParam();
1931               /**
1932                * nat parameter
1933                * StaticParam ::= nat Id
1934                * e.g.) nat len
1935                */
1936                NatParam();
1937               /**
1938                * type parameter
1939                * StaticParam ::= Id Extends? (absorbs unit)?
1940                * e.g.) EltType extends Number absorbs unit
1941                */
1942                TypeParam(List<BaseType> extendsClause =
1943                              Collections.<BaseType>emptyList(),
1944                          boolean absorbs = false);
1945               /**
1946                * unit parameter
1947                * StaticParam ::= unit Id (: Type)? (absorbs unit)?
1948                * e.g.) unit U absrbs unit
1949                */
1950                UnitParam(Option<Type> dim = Option.<Type>none(),
1951                          boolean absorbs = false);
1952        /**
1953         * name used in declarations and references
1954         */
1955        abstract Name();
1956            /**
1957             * unstructured sequence of ids naming an API or component
1958             * Names in the list must be unqualified.
1959             * APIName ::= Id(.Id)*
1960             * e.g.) com.sun.fortress.nodes_util
1961             *
1962             */
1963            APIName(List<Id> ids,
1964                    ignoreForEquals String text = com.sun.fortress.useful.Useful.<Id>dottedList(in_ids).intern());
1965            /**
1966             * non-API name
1967             * SimpleName ::= Id
1968             *              | opr Op
1969             *              | opr EncloserPair
1970             */
1971            abstract IdOrOpOrAnonymousName(Option<APIName> api
1972                                               = Option.<APIName>none());
1973                /**
1974                 * identifier or operator name
1975                 */
1976                abstract IdOrOpName();
1977                    /**
1978                     * identifier name
1979                     * e.g.) hashCode
1980                     */
1981                    Id(String text);
1982                    /**
1983                     * operator name
1984                     */
1985                    abstract OpName();
1986                        /**
1987                         * non-enclosing operator
1988                         * e.g.) COMPOSE
1989                         * e.g.) ===
1990                         */
1991                        Op(String text,
1992                           Option<Fixity> fixity = Option.<Fixity>none());
1993                        /**
1994                         * pair of enclosing operators
1995                         * Opening and closing Ops must be unqualified.
1996                         * EncloserPair ::= (LeftEncloser | Encloser)
1997                         *                    (RightEncloser | Encloser)
1998                         * e.g.) </ />
1999                         */
2000                        Enclosing(Op open, Op close);
2001                /**
2002                 * anonymous name; used internally
2003                 */
2004                abstract AnonymousName();
2005                    /**
2006                     * internal name for anonymous function expressions
2007                     * not created during parsing but during evaluation
2008                     * e.g.) name for "fn x => x + 1"
2009                     */
2010                    AnonymousFnName();
2011                    /**
2012                     * internal name for anonymous constructor expressions
2013                     * not created during parsing but during evaluation
2014                     * e.g.) name for "object extends List cons(x) = Cons(x, self) end"
2015                     */
2016                    ConstructorFnName(GenericWithParams def);
2017        /**
2018         * array comprehension clause
2019         * ArrayComprehensionClause ::= ArrayComprehensionLeft | GeneratorClauseList
2020         * ArrayComprehensionLeft ::= IdOrInt |-> Expr
2021         *                          | ( IdOrInt, IdOrIntList ) |-> Expr
2022         * IdOrInt ::= Id
2023         *           | IntLiteralExpr
2024         * e.g.) (x, y) = 0 | x <- {0, 1, 2}, y <- {0, 1, 2}
2025         */
2026        ArrayComprehensionClause(List<Expr> bind, Expr init,
2027                                 List<GeneratorClause> gens);
2028        /**
2029         * keyword expression used in argument expressions
2030         * Names must be unqualified.
2031         * KeywordExpr ::= BindId = Expr
2032         * e.g.) x = myLoser.myField
2033         */
2034        KeywordExpr(Id name, Expr init);
2035        /**
2036         * case clause used in case expressions and extremum expressions
2037         * CaseClause ::= Expr => BlockElems
2038         * e.g.) { Jupiter, Saturn, Uranus, Neptune } => "outer"
2039         */
2040        CaseClause(Expr match, Block body);
2041        /**
2042         * catch clause used in try expressions
2043         * Names must be unqualified.
2044         * Catch ::= catch BindId CatchClauses
2045         * e.g.) catch e IOException => throw ForbiddenException(e)
2046         */
2047        Catch(Id name, List<CatchClause> clauses);
2048        /**
2049         * each clause in a catch clause used in try expressions
2050         * CatchClause ::= TraitType => BlockElems
2051         * e.g.) IOException => throw ForbiddenException(e)
2052         */
2053        CatchClause(BaseType match, Block body);
2054        /**
2055         * block expression used in do expressions
2056         * DoFront ::= (at Expr)? atomic? do BlockElems?
2057         * e.g.) at a.region(j) do w := a_j
2058         */
2059        DoFront(Option<Expr> loc = Option.<Expr>none(), boolean atomic = false,
2060                Block expr);
2061        /**
2062         * if clause used in if expressions
2063         * DelimitedExpr ::= if Expr then BlockElems Elifs? Else? end
2064         * Elif ::= elif Expr then BlockElems
2065         * e.g.) if x IN { 0, 1, 2 } then 0
2066         */
2067        IfClause(GeneratorClause test, Block body);
2068        /**
2069         * typecase clause used in typecase expressions
2070         * TypecaseClause ::= TypecaseTypes => BlockElems
2071         * TypecaseTypes ::= ( TypeList )
2072         *                 | Type
2073         * e.g.) String => x.append("foo")
2074         */
2075        TypecaseClause(List<Type> match, Block body);
2076        /**
2077         * array and matrix size
2078         * ExtentRange ::= StaticArg? # StaticArg?
2079         *               | StaticArg? : StaticArg?
2080         *               | StaticArg
2081         * e.g.) 3#5
2082         */
2083        ExtentRange(Option<StaticArg> base, Option<StaticArg> size);
2084        /**
2085         * generator
2086         * Names must be unqualified.
2087         * GeneratorClauseList ::= GeneratorBinding (, GeneratorClause)*
2088         * GeneratorBinding ::= BindIdOrBindIdTuple <- Expr
2089         * GeneratorClause ::= GeneratorBinding
2090         *                   | Expr
2091         * e.g.) (i, j) <- my2DArray.indices
2092         */
2093        GeneratorClause(List<Id> bind, Expr init);
2094        /**
2095         * varargs expression used in tuple expressions
2096         * Expr...
2097         * e.g.) [3 4 5]...
2098         */
2099        VarargsExpr(Expr varargs);
2100        /**
2101         * keyword type used in tuple types
2102         * Names must be unqualified.
2103         * KeywordType ::= BindId = Type
2104         * e.g.) x = String
2105         */
2106        KeywordType(Id name, Type type);
2107        /**
2108         * trait type with a where clause used in extends clauses
2109         * TraitTypeWhere ::= TraitType Where?
2110         * e.g.) T[\ninf, nan\] where { ninf AND NOT nan }
2111         */
2112        TraitTypeWhere(BaseType type, WhereClause where);
2113        /**
2114         * array dimensionality
2115         * ArraySize ::= ExtentRange(, ExtentRange)*
2116         * e.g.) 3, 2#1, 3:5
2117         */
2118        Indices(List<ExtentRange> extents);
2119        /**
2120         * mathematical item
2121         */
2122        abstract MathItem();
2123            /**
2124             * mathematical item that is an expression element
2125             */
2126            abstract ExprMI(Expr expr);
2127                /**
2128                 * mathematical item that is a parenthesis delimited expression
2129                 * MathItem ::= ParenthesisDelimited
2130                 * e.g.) ( 3 + 4 )
2131                 */
2132                ParenthesisDelimitedMI();
2133                /**
2134                 * mathematical item that is not a parenthesis delimited expression
2135                 * MathItem ::= VarOrFnRef
2136                 *            | LiteralExpr
2137                 *            | self
2138                 * e.g.) self
2139                 */
2140                NonParenthesisDelimitedMI();
2141            /**
2142             * mathematical item that is a non-expression element
2143             */
2144            abstract NonExprMI();
2145                /**
2146                 * mathematical item that is an exponentiation
2147                 * MathItem ::= Exponentiation
2148                 * e.g.) ^3
2149                 */
2150                ExponentiationMI(OpRef op, Option<Expr> expr);
2151                /**
2152                 * mathematical item that is a subscripting
2153                 * MathItem ::= Subscripting
2154                 * e.g.) [3, 4]
2155                 */
2156                SubscriptingMI(Enclosing op, List<Expr> exprs,
2157                               List<StaticArg> staticArgs);
2158        /**
2159         * operator fixity
2160         */
2161        abstract Fixity();
2162            /**
2163             * e.g.) 3 + 5
2164             */
2165            InFixity();
2166            /**
2167             * e.g.) -5
2168             */
2169            PreFixity();
2170            /**
2171             * e.g.) 3!
2172             */
2173            PostFixity();
2174            /**
2175             * e.g.) :
2176             */
2177            NoFixity();
2178            /**
2179             * e.g.) S1 BY S2 BY S3
2180             */
2181            MultiFixity();
2182            /**
2183             * left encloser or right encloser
2184             * e.g.) <|
2185             */
2186            EnclosingFixity();
2187            /**
2188             * BIG operator
2189             * e.g.) SUM
2190             */
2191            BigFixity();
2192        /*
2193         * A Link in a ChainExpr is a pair of OpRef and the next Expr in the chain.
2194         * e.g.) < 5
2195         */
2196        Link(OpRef op, Expr expr);
2197
2198    end;
Note: See TracBrowser for help on using the browser.