| 219 | | * trait or object declaration in components or APIs |
| 220 | | * Name must be unqualified. |
| 221 | | */ |
| 222 | | abstract TraitObjectDecl(List<Modifier> mods |
| 223 | | = Collections.<Modifier>emptyList(), |
| 224 | | Id name, |
| 225 | | List<StaticParam> staticParams |
| 226 | | = Collections.<StaticParam>emptyList(), |
| 227 | | List<TraitTypeWhere> extendsClause |
| 228 | | = Collections.<TraitTypeWhere>emptyList(), |
| 229 | | Option<WhereClause> where |
| 230 | | = Option.<WhereClause>none(), |
| 231 | | List<Decl> decls) |
| 232 | | implements HasWhere, GenericDecl; |
| 233 | | /** |
| 234 | | * trait declaration in components or APIs |
| | 212 | * declaration in components or APIs |
| | 213 | */ |
| | 214 | abstract Decl(); |
| | 215 | /** |
| | 216 | * trait or object declaration in components or APIs |
| | 217 | * Name must be unqualified. |
| | 218 | */ |
| | 219 | abstract TraitObjectDecl(List<Modifier> mods |
| | 220 | = Collections.<Modifier>emptyList(), |
| | 221 | Id name, |
| | 222 | List<StaticParam> staticParams |
| | 223 | = Collections.<StaticParam>emptyList(), |
| | 224 | List<TraitTypeWhere> extendsClause |
| | 225 | = Collections.<TraitTypeWhere>emptyList(), |
| | 226 | Option<WhereClause> where |
| | 227 | = Option.<WhereClause>none(), |
| | 228 | List<Decl> decls) |
| | 229 | implements HasWhere, GenericDecl; |
| | 230 | /** |
| | 231 | * trait declaration in components or APIs |
| | 232 | * |
| | 233 | * trait declaration in APIs |
| | 234 | * AbsTraitDecl ::= AbsTraitMods? TraitHeaderFront AbsTraitClauses |
| | 235 | * AbsGoInATrait? end |
| | 236 | * TraitHeaderFront ::= trait Id StaticParams? ExtendsWhere? |
| | 237 | * ExtendsWhere ::= extends TraitTypeWheres |
| | 238 | * AbsTraitClause ::= Excludes | AbsComprises | Where |
| | 239 | * Excludes ::= excludes TraitTypes |
| | 240 | * AbsComprises ::= comprises ComprisingTypes |
| | 241 | * ComprisingTypes ::= TraitType | { ComprisingTypeList } |
| | 242 | * ComprisingTypeList ::= ... |
| | 243 | * | TraitType(, TraitType)*(, ...)? |
| | 244 | * AbsGoInATrait ::= AbsCoercions? AbsGoFrontInATrait AbsGoBackInATrait? |
| | 245 | * | AbsCoercions? AbsGoBackInATrait |
| | 246 | * | AbsCoercions |
| | 247 | * AbsGoesFrontInATrait ::= ApiFldDecl |
| | 248 | * | AbsGetterSetterDecl |
| | 249 | * | PropertyDecl |
| | 250 | * AbsGoesBackInATrait ::= AbsMdDecl |
| | 251 | * | PropertyDecl |
| | 252 | * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]} |
| | 253 | * cons(x: alph): List[\alpha\] |
| | 254 | * end |
| | 255 | * |
| | 256 | * trait declaration in components |
| | 257 | * TraitDecl ::= TraitMods? TraitHeaderFront TraitClauses GoInATrait? |
| | 258 | * end |
| | 259 | * TraitClause ::= Excludes | Comprises | Where |
| | 260 | * Comprises ::= comprises TraitTypes |
| | 261 | * GoInATrait ::= Coercions? GoFrontInATrait GoBackInATrait? |
| | 262 | * | Coercions? GoBackInATrait |
| | 263 | * | Coercions |
| | 264 | * GoesFrontInATrait ::= AbsFldDecl |
| | 265 | * | GetterSetterDecl |
| | 266 | * | PropertyDecl |
| | 267 | * GoesBackInATrait ::= MdDecl |
| | 268 | * | PropertyDecl |
| | 269 | * e.g.) trait List[\alpha\] comprises {Cons[\alpha\],Empty[\alpha\]} |
| | 270 | * cons(x: alph): List[\alpha\] = Cons[\alph\](x, self) |
| | 271 | * end |
| | 272 | */ |
| | 273 | TraitDecl(List<BaseType> excludes = Collections.<BaseType>emptyList(), |
| | 274 | Option<List<BaseType>> comprises |
| | 275 | = Option.<List<BaseType>>none(), |
| | 276 | List<Decl> decls) implements GenericDecl; |
| | 277 | /** |
| | 278 | * object declaration in components or APIs |
| | 279 | * |
| | 280 | * object declaration in APIs |
| | 281 | * AbsObjectDecl ::= AbsObjectMods? ObjectHeader AbsGoInAnObject? end |
| | 282 | * ObjectHeader ::= object Id StaticParams? ObjectValParam? |
| | 283 | * ExtendsWhere? FnClauses |
| | 284 | * FnClauses ::= Throws? Where? Contract |
| | 285 | * Throws ::= throws MayTraitTypes |
| | 286 | * ObjectValParam ::= ( ObjectParams? ) |
| | 287 | * ObjectParams ::= (ObjectParam ,)* ObjectKeyword(, ObjectKeyword)* |
| | 288 | * | ObjectParam (, ObjectParam)* |
| | 289 | * ObjectKeyword ::= ObjectParam = Expr |
| | 290 | * ObjectParam ::= ParamFldMods? Param |
| | 291 | * | var Param |
| | 292 | * AbsGoInAnObject ::= AbsCoercions? AbsGoFrontInAnObject AbsGoBackInAnObject? |
| | 293 | * | AbsCoercions? AbsGoBackInAnObject |
| | 294 | * | AbsCoercions |
| | 295 | * AbsGoesFrontInAnObject ::= ApiFldDecl |
| | 296 | * | AbsGetterSetterDecl |
| | 297 | * | PropertyDecl |
| | 298 | * AbsGoesBackInAnObject ::= AbsMdDecl |
| | 299 | * | PropertyDecl |
| | 300 | * e.g.) object Empty[\alph\]() extends List[\alpha\] end |
| | 301 | * |
| | 302 | * object declaration in components |
| | 303 | * ObjectDecl ::= ObjectMods? ObjectHeader GoInAnObject? end |
| | 304 | * GoInAnObject ::= Coercions? GoFrontInAnObject GoBackInAnObject? |
| | 305 | * | Coercions? GoBackInAnObject |
| | 306 | * | Coercions |
| | 307 | * GoesFrontInAnObject ::= FldDecl |
| | 308 | * | GetterSetterDecl |
| | 309 | * | PropertyDecl |
| | 310 | * GoesBackInAnObject ::= MdDef |
| | 311 | * | PropertyDecl |
| | 312 | * e.g.) object Empty[\alph\]() extends List[\alpha\] |
| | 313 | * length() = 0 |
| | 314 | * end |
| | 315 | */ |
| | 316 | ObjectDecl(Option<List<Param>> params = Option.<List<Param>>none(), |
| | 317 | Option<List<BaseType>> throwsClause |
| | 318 | = Option.<List<BaseType>>none(), |
| | 319 | Option<Contract> contract = Option.<Contract>none(), |
| | 320 | List<Decl> decls) |
| | 321 | implements GenericDeclWithParams; |
| | 322 | /** |
| | 323 | * variable declaration in components or APIs |
| 305 | | * object declaration in components |
| 306 | | * ObjectDecl ::= ObjectMods? ObjectHeader GoInAnObject? end |
| 307 | | * GoInAnObject ::= Coercions? GoFrontInAnObject GoBackInAnObject? |
| 308 | | * | Coercions? GoBackInAnObject |
| 309 | | * | Coercions |
| 310 | | * GoesFrontInAnObject ::= FldDecl |
| 311 | | * | GetterSetterDecl |
| 312 | | * | PropertyDecl |
| 313 | | * GoesBackInAnObject ::= MdDef |
| 314 | | * | PropertyDecl |
| 315 | | * e.g.) object Empty[\alph\]() extends List[\alpha\] |
| 316 | | * length() = 0 |
| 317 | | * end |
| 318 | | */ |
| 319 | | ObjectDecl(Option<List<Param>> params = Option.<List<Param>>none(), |
| 320 | | Option<List<BaseType>> throwsClause |
| 321 | | = Option.<List<BaseType>>none(), |
| 322 | | Option<Contract> contract = Option.<Contract>none(), |
| 323 | | List<Decl> decls) |
| 324 | | implements GenericDeclWithParams; |
| 325 | | /** |
| 326 | | * variable declaration in components or APIs |
| 327 | | * |
| 328 | | * variable declaration in APIs |
| 329 | | * AbsVarDecl ::= AbsVarMods? VarWTypes |
| 330 | | * | AbsVarMods? BindIdOrBindIdTuple : Type ... |
| 331 | | * | AbsVarMods? BindIdOrBindIdTuple : SimpleTupleType |
| 332 | | * VarWTypes ::= VarWType | ( VarWType(, VarWType)+ ) |
| 333 | | * VarWType ::= BindId IsType |
| 334 | | * BindIdOrBindIdTuple ::= BindId |
| 335 | | * | ( BindId , BindIdList ) |
| 336 | | * BindId ::= Id | _ |
| 337 | | * e.g.) var (x, y): ZZ64... |
| 338 | | * |
| 339 | | * variable declaration in components |
| 340 | | * VarDecl ::= VarMods? VarWTypes InitVal |
| 341 | | * | VarMods? BindIdOrBindIdTuple = Expr |
| 342 | | * | VarMods? BindIdOrBindIdTuple : Type ... InitVal |
| 343 | | * | VarMods? BindIdOrBindIdTuple : SimpleTupleType InitVal |
| 344 | | * InitVal ::= (= | :=) Expr |
| 345 | | * e.g.) var (x, y): ZZ64... = (5, 6) |
| 346 | | */ |
| 347 | | VarDecl(List<LValue> lhs, Option<Expr> init) implements Decl; |
| | 370 | * functional declaration in components |
| | 371 | * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr |
| | 372 | * e.g.) swap (x, y) = (y, x) |
| | 373 | */ |
| | 374 | FnDecl(List<Modifier> mods = Collections.<Modifier>emptyList(), |
| | 375 | IdOrOpOrAnonymousName name, |
| | 376 | List<StaticParam> staticParams |
| | 377 | = Collections.<StaticParam>emptyList(), |
| | 378 | List<Param> params = Collections.<Param>emptyList(), |
| | 379 | Option<Type> returnType = Option.<Type>none(), |
| | 380 | Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), |
| | 381 | Option<WhereClause> where = Option.<WhereClause>none(), |
| | 382 | Option<Contract> contract = Option.<Contract>none(), |
| | 383 | Id unambiguousName = new Id(in_span, "FN$"+in_span.toString()), |
| | 384 | Option<Expr> body, |
| | 385 | Option<Id> implementsUnambiguousName = Option.<Id>none()) |
| | 386 | implements Applicable, GenericDecl; |
| | 387 | /** |
| | 388 | * dimension and unit declaration |
| | 389 | * DimUnitDecl may represent a single dimension declaration, a single |
| | 390 | * unit declaration, or both dimension and unit declarations. |
| | 391 | * DimUnitDecl ::= dim Id (= Type)? (unit | SI_unit) Id+ (= Expr)? |
| | 392 | * | dim Id (= Type)? (default Id)? |
| | 393 | * | (unit | SI_unit) Id+ (: Type)? (= Expr)? |
| | 394 | */ |
| | 395 | abstract DimUnitDecl(); |
| | 396 | /** |
| | 397 | * dimension declaration |
| | 398 | * Names for dim and default must be unqualified. |
| | 399 | * e.g.) dim Length SI_unit meter meters m |
| | 400 | */ |
| | 401 | DimDecl(Id dim, Option<Type> derived = Option.<Type>none(), |
| | 402 | Option<Id> default = Option.<Id>none()); |
| | 403 | /** |
| | 404 | * unit declaration |
| | 405 | * Names of units must be unqualified. |
| | 406 | * e.g.) unit inch inches: Length |
| | 407 | */ |
| | 408 | UnitDecl(boolean si_unit = false, |
| | 409 | List<Id> units = Collections.<Id>emptyList(), |
| | 410 | Option<Type> dim = Option.<Type>none(), |
| | 411 | Option<Expr> def); |
| | 412 | /** |
| | 413 | * test declaration |
| | 414 | * Names must be unqualified. |
| | 415 | * TestDecl ::= test Id [ GeneratorClauseList ] = Expr |
| | 416 | * e.g.) test fxLessThanFy[x <- E, y <- F] = assert(f(x) < f(y)) |
| | 417 | */ |
| | 418 | TestDecl(Id name, List<GeneratorClause> gens, Expr expr); |
| | 419 | /** |
| | 420 | * property declaration |
| | 421 | * Names must be unqualified. |
| | 422 | * PropertyDecl ::= property (Id = )? (FORALL ValParam)? Expr |
| | 423 | * e.g.) property fIsMonotonic = FORALL (x:ZZ, y:ZZ) (x < y) -> (f(x) < f(y)) |
| | 424 | */ |
| | 425 | PropertyDecl(Option<Id> name = Option.<Id>none(), List<Param> params, |
| | 426 | Expr expr); |
| | 427 | /** |
| | 428 | * type alias declaration |
| | 429 | * TypeAlias ::= type Id StaticParams? = Type |
| | 430 | * e.g.) type IntList = List[\ZZ64\] |
| | 431 | */ |
| | 432 | TypeAlias(Id name, |
| | 433 | List<StaticParam> staticParams |
| | 434 | = Collections.<StaticParam>emptyList(), |
| | 435 | Type type); |
| | 436 | /** |
| | 437 | * grammar declaration |
| | 438 | * Names (but not extends elements) must be unqualified. |
| | 439 | */ |
| | 440 | abstract GrammarDecl(Id name, List<Id> extends); |
| | 441 | /** |
| | 442 | * grammar definition |
| | 443 | */ |
| | 444 | GrammarDef(List<GrammarMemberDecl> members, List<TransformerDecl> transformers, |
| | 445 | boolean native); |
| | 446 | /** |
| | 447 | * grammar member (nonterminal or terminal) declaration |
| | 448 | * Names and params must be unqualified. |
| | 449 | */ |
| | 450 | abstract GrammarMemberDecl(Id name); |
| | 451 | /** |
| | 452 | * nonterminal declaration |
| | 453 | */ |
| | 454 | abstract NonterminalDecl(List<SyntaxDecl> syntaxDecls); |
| | 455 | /** |
| | 456 | * nonterminal definition in nonterminal declarations |
| | 457 | */ |
| | 458 | NonterminalDef(NonterminalHeader header, Option<BaseType> astType); |
| | 459 | /** |
| | 460 | * nonterminal extending definition in nonterminal declarations |
| | 461 | */ |
| | 462 | NonterminalExtensionDef(); |
| | 463 | /** |
| | 464 | * nonterminal header |
| | 465 | */ |
| | 466 | NonterminalHeader(Option<ModifierPrivate> modifier |
| | 467 | = Option.<ModifierPrivate>none(), |
| | 468 | Id name, |
| | 469 | List<NonterminalParameter> params, |
| | 470 | List<StaticParam> staticParams |
| | 471 | = Collections.<StaticParam>emptyList(), |
| | 472 | Option<Type> type, |
| | 473 | Option<WhereClause> whereClause |
| | 474 | = Option.<WhereClause>none()); |
| | 475 | |
| | 476 | /** |
| | 477 | * nonterminal parameter |
| | 478 | */ |
| | 479 | NonterminalParameter(Id name, BaseType type); |
| | 480 | |
| | 481 | /** |
| | 482 | * syntax declaration |
| | 483 | */ |
| | 484 | abstract SyntaxDecl(Option<String> modifier); |
| | 485 | /** |
| | 486 | * syntax definition in syntax declarations |
| | 487 | */ |
| | 488 | SyntaxDef(List<SyntaxSymbol> syntaxSymbols, |
| | 489 | TransformerDecl transformer); |
| | 490 | |
| | 491 | SuperSyntaxDef(Id nonterminal, Id grammar); |
| | 492 | |
| | 493 | /** |
| | 494 | * Transformation declaration |
| | 495 | */ |
| | 496 | abstract TransformerDecl(); |
| | 497 | /** |
| | 498 | * pre transformer definition in transformer declarations |
| | 499 | */ |
| | 500 | PreTransformerDef(Transformer transformer); |
| | 501 | /** |
| | 502 | * transformer definition in transformer declarations |
| | 503 | */ |
| | 504 | NamedTransformerDef(String name, List<NonterminalParameter> parameters, Transformer transformer); |
| | 505 | |
| | 506 | /** |
| | 507 | * Transformers |
| | 508 | */ |
| | 509 | abstract Transformer(); |
| | 510 | /** |
| | 511 | * Unparsed template |
| | 512 | */ |
| | 513 | UnparsedTransformer(String transformer, Id nonterminal); |
| | 514 | /** |
| | 515 | * Parsed template |
| | 516 | */ |
| | 517 | NodeTransformer(AbstractNode node); |
| | 518 | /** |
| | 519 | * Case-dispatch transformer expr |
| | 520 | */ |
| | 521 | CaseTransformer(Id gapName, List<CaseTransformerClause> clauses); |
| | 522 | |
| | 523 | /** |
| | 524 | * Case transformer clause |
| | 525 | */ |
| | 526 | CaseTransformerClause(Id constructor, List<Id> parameters, Transformer body); |
| | 527 | |
| | 528 | /** |
| | 529 | * syntax symbol |
| | 530 | */ |
| | 531 | abstract SyntaxSymbol(); |
| | 532 | /** |
| | 533 | * prefixed syntax symbol |
| | 534 | */ |
| | 535 | PrefixedSymbol(Id id, SyntaxSymbol symbol); |
| | 536 | /** |
| | 537 | * optional syntax symbol |
| | 538 | */ |
| | 539 | OptionalSymbol(SyntaxSymbol symbol); |
| | 540 | /** |
| | 541 | * repeat zero-or-more syntax symbol |
| | 542 | */ |
| | 543 | RepeatSymbol(SyntaxSymbol symbol); |
| | 544 | /** |
| | 545 | * repeat one-or-more syntax symbol |
| | 546 | */ |
| | 547 | RepeatOneOrMoreSymbol(SyntaxSymbol symbol); |
| | 548 | /** |
| | 549 | * ignore following whitespace syntax symbol |
| | 550 | */ |
| | 551 | NoWhitespaceSymbol(SyntaxSymbol symbol); |
| | 552 | /** |
| | 553 | * groups of symbols |
| | 554 | */ |
| | 555 | GroupSymbol(List<SyntaxSymbol> symbols); |
| | 556 | /** |
| | 557 | * special symbols syntax symbol |
| | 558 | */ |
| | 559 | abstract SpecialSymbol(); |
| | 560 | /** |
| | 561 | * any character syntax symbol |
| | 562 | */ |
| | 563 | AnyCharacterSymbol(); |
| | 564 | /** |
| | 565 | * whitespace syntax symbol |
| | 566 | */ |
| | 567 | WhitespaceSymbol(String s); |
| | 568 | /** |
| | 569 | * tab syntax symbol |
| | 570 | */ |
| | 571 | TabSymbol(); |
| | 572 | /** |
| | 573 | * formfeed syntax symbol |
| | 574 | */ |
| | 575 | FormfeedSymbol(); |
| | 576 | /** |
| | 577 | * carriage return syntax symbol |
| | 578 | */ |
| | 579 | CarriageReturnSymbol(); |
| | 580 | /** |
| | 581 | * backspace syntax symbol |
| | 582 | */ |
| | 583 | BackspaceSymbol(); |
| | 584 | /** |
| | 585 | * newline syntax symbol |
| | 586 | */ |
| | 587 | NewlineSymbol(); |
| | 588 | /** |
| | 589 | * breakline syntax symbol |
| | 590 | */ |
| | 591 | BreaklineSymbol(String s); |
| | 592 | /** |
| | 593 | * item syntax symbol; |
| | 594 | * may be either nonterminal or keyword |
| | 595 | */ |
| | 596 | ItemSymbol(String item); |
| | 597 | /** |
| | 598 | * non-terminal syntax symbol |
| | 599 | */ |
| | 600 | NonterminalSymbol(Id nonterminal); |
| | 601 | /** |
| | 602 | * keyword syntax symbol |
| | 603 | */ |
| | 604 | KeywordSymbol(String token); |
| | 605 | /** |
| | 606 | * token syntax symbol |
| | 607 | */ |
| | 608 | TokenSymbol(String token); |
| | 609 | /** |
| | 610 | * not predicate syntax symbol |
| | 611 | */ |
| | 612 | NotPredicateSymbol(SyntaxSymbol symbol); |
| | 613 | /** |
| | 614 | * and predicate syntax symbol |
| | 615 | */ |
| | 616 | AndPredicateSymbol(SyntaxSymbol symbol); |
| | 617 | /** |
| | 618 | * character class syntax symbol |
| | 619 | */ |
| | 620 | CharacterClassSymbol(List<CharacterSymbol> characters); |
| | 621 | /** |
| | 622 | * character symbols |
| | 623 | */ |
| | 624 | abstract CharacterSymbol(); |
| | 625 | /** |
| | 626 | * character |
| | 627 | */ |
| | 628 | CharSymbol(String string); |
| | 629 | /** |
| | 630 | * character interval |
| | 631 | */ |
| | 632 | CharacterInterval(String begin, String end); |
| 356 | | /** |
| 357 | | * Overloading specification |
| 358 | | */ |
| 359 | | _RewriteFnOverloadDecl(IdOrOpName name, |
| 360 | | List<IdOrOpName> fns) implements Decl; |
| 361 | | /** |
| 362 | | * functional declaration in components or APIs |
| 363 | | * Names must be unqualified. |
| 364 | | * |
| 365 | | * functional declaration in components or APIs |
| 366 | | * AbsFnDecl ::= AbsFnMods? FnHeaderFront FnHeaderClause |
| 367 | | * | FnSig |
| 368 | | * FnSig ::= SimpleName : ArrowType |
| 369 | | * FnHeaderFront ::= NamedFnHeaderFront |
| 370 | | * | OpHeaderFront |
| 371 | | * NamedFnHeaderFront ::= Id StaticParams? ValParam |
| 372 | | * OpHeaderFront ::= opr StaticParams? BIG? (LeftEncloser | Encloser) |
| 373 | | * Params (RightEncloser | Encloser) |
| 374 | | * | opr StaticParams? ValParam (Op | ExponentOp) |
| 375 | | * | opr BIG? (Op | ^ | Encloser) StaticParams? ValParam |
| 376 | | * FnHeaderClause ::= IsType? FnClauses |
| 377 | | * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause |
| 378 | | * | FnSig |
| 379 | | * e.g.) swap (x: Object, y: Object): (Object, Object) |
| 380 | | * |
| 381 | | * functional declaration in components |
| 382 | | * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr |
| 383 | | * e.g.) swap (x, y) = (y, x) |
| 384 | | */ |
| 385 | | FnDecl(List<Modifier> mods = Collections.<Modifier>emptyList(), |
| 386 | | IdOrOpOrAnonymousName name, |
| 387 | | List<StaticParam> staticParams |
| 388 | | = Collections.<StaticParam>emptyList(), |
| 389 | | List<Param> params = Collections.<Param>emptyList(), |
| 390 | | Option<Type> returnType = Option.<Type>none(), |
| 391 | | Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), |
| 392 | | Option<WhereClause> where = Option.<WhereClause>none(), |
| 393 | | Option<Contract> contract = Option.<Contract>none(), |
| 394 | | Id unambiguousName = new Id(in_span, "FN$"+in_span.toString()), |
| 395 | | Option<Expr> body, |
| 396 | | Option<Id> implementsUnambiguousName = Option.<Id>none()) |
| 397 | | implements Applicable, GenericDecl; |
| 425 | | /** |
| 426 | | * dimension and unit declaration |
| 427 | | * DimUnitDecl may represent a single dimension declaration, a single |
| 428 | | * unit declaration, or both dimension and unit declarations. |
| 429 | | * DimUnitDecl ::= dim Id (= Type)? (unit | SI_unit) Id+ (= Expr)? |
| 430 | | * | dim Id (= Type)? (default Id)? |
| 431 | | * | (unit | SI_unit) Id+ (: Type)? (= Expr)? |
| 432 | | */ |
| 433 | | abstract DimUnitDecl() implements Decl; |
| 434 | | /** |
| 435 | | * dimension declaration |
| 436 | | * Names for dim and default must be unqualified. |
| 437 | | * e.g.) dim Length SI_unit meter meters m |
| 438 | | */ |
| 439 | | DimDecl(Id dim, Option<Type> derived = Option.<Type>none(), |
| 440 | | Option<Id> default = Option.<Id>none()); |
| 441 | | /** |
| 442 | | * unit declaration |
| 443 | | * Names of units must be unqualified. |
| 444 | | * e.g.) unit inch inches: Length |
| 445 | | */ |
| 446 | | UnitDecl(boolean si_unit = false, |
| 447 | | List<Id> units = Collections.<Id>emptyList(), |
| 448 | | Option<Type> dim = Option.<Type>none(), |
| 449 | | Option<Expr> def); |
| 450 | | /** |
| 451 | | * test declaration |
| 452 | | * Names must be unqualified. |
| 453 | | * TestDecl ::= test Id [ GeneratorClauseList ] = Expr |
| 454 | | * e.g.) test fxLessThanFy[x <- E, y <- F] = assert(f(x) < f(y)) |
| 455 | | */ |
| 456 | | TestDecl(Id name, List<GeneratorClause> gens, Expr expr) |
| 457 | | implements Decl; |
| 458 | | /** |
| 459 | | * property declaration |
| 460 | | * Names must be unqualified. |
| 461 | | * PropertyDecl ::= property (Id = )? (FORALL ValParam)? Expr |
| 462 | | * e.g.) property fIsMonotonic = FORALL (x:ZZ, y:ZZ) (x < y) -> (f(x) < f(y)) |
| 463 | | */ |
| 464 | | PropertyDecl(Option<Id> name = Option.<Id>none(), List<Param> params, |
| 465 | | Expr expr) implements Decl; |
| 466 | | /** |
| 467 | | * grammar declaration |
| 468 | | * Names (but not extends elements) must be unqualified. |
| 469 | | */ |
| 470 | | abstract GrammarDecl(Id name, List<Id> extends) implements Decl; |
| 471 | | /** |
| 472 | | * grammar definition |
| 473 | | */ |
| 474 | | GrammarDef(List<GrammarMemberDecl> members, List<TransformerDecl> transformers, |
| 475 | | boolean native); |
| 476 | | /** |
| 477 | | * grammar member (nonterminal or terminal) declaration |
| 478 | | * Names and params must be unqualified. |
| 479 | | */ |
| 480 | | abstract GrammarMemberDecl(Id name) implements Decl; |
| 481 | | /** |
| 482 | | * nonterminal declaration |
| 483 | | */ |
| 484 | | abstract NonterminalDecl(List<SyntaxDecl> syntaxDecls); |
| 485 | | /** |
| 486 | | * nonterminal definition in nonterminal declarations |
| 487 | | */ |
| 488 | | NonterminalDef(NonterminalHeader header, Option<BaseType> astType); |
| 489 | | /** |
| 490 | | * nonterminal extending definition in nonterminal declarations |
| 491 | | */ |
| 492 | | NonterminalExtensionDef(); |
| 493 | | /** |
| 494 | | * nonterminal header |
| 495 | | */ |
| 496 | | NonterminalHeader(Option<ModifierPrivate> modifier |
| 497 | | = Option.<ModifierPrivate>none(), |
| 498 | | Id name, |
| 499 | | List<NonterminalParameter> params, |
| 500 | | List<StaticParam> staticParams |
| 501 | | = Collections.<StaticParam>emptyList(), |
| 502 | | Option<Type> type, |
| 503 | | Option<WhereClause> whereClause |
| 504 | | = Option.<WhereClause>none()); |
| 505 | | |
| 506 | | /** |
| 507 | | * nonterminal parameter |
| 508 | | */ |
| 509 | | NonterminalParameter(Id name, BaseType type); |
| 510 | | |
| 511 | | /** |
| 512 | | * syntax declaration |
| 513 | | */ |
| 514 | | abstract SyntaxDecl(Option<String> modifier) implements Decl; |
| 515 | | /** |
| 516 | | * syntax definition in syntax declarations |
| 517 | | */ |
| 518 | | SyntaxDef(List<SyntaxSymbol> syntaxSymbols, |
| 519 | | TransformerDecl transformer); |
| 520 | | |
| 521 | | SuperSyntaxDef(Id nonterminal, Id grammar); |
| 522 | | |
| 523 | | /** |
| 524 | | * Transformation declaration |
| 525 | | */ |
| 526 | | abstract TransformerDecl() implements Decl; |
| 527 | | /** |
| 528 | | * pre transformer definition in transformer declarations |
| 529 | | */ |
| 530 | | PreTransformerDef(Transformer transformer); |
| 531 | | /** |
| 532 | | * transformer definition in transformer declarations |
| 533 | | */ |
| 534 | | NamedTransformerDef(String name, List<NonterminalParameter> parameters, Transformer transformer); |
| 535 | | |
| 536 | | /** |
| 537 | | * Transformers |
| 538 | | */ |
| 539 | | abstract Transformer(); |
| 540 | | /** |
| 541 | | * Unparsed template |
| 542 | | */ |
| 543 | | UnparsedTransformer(String transformer, Id nonterminal); |
| 544 | | /** |
| 545 | | * Parsed template |
| 546 | | */ |
| 547 | | NodeTransformer(AbstractNode node); |
| 548 | | /** |
| 549 | | * Case-dispatch transformer expr |
| 550 | | */ |
| 551 | | CaseTransformer(Id gapName, List<CaseTransformerClause> clauses); |
| 552 | | |
| 553 | | /** |
| 554 | | * Case transformer clause |
| 555 | | */ |
| 556 | | CaseTransformerClause(Id constructor, List<Id> parameters, Transformer body); |
| 557 | | |
| 558 | | /** |
| 559 | | * syntax symbol |
| 560 | | */ |
| 561 | | abstract SyntaxSymbol(); |
| 562 | | /** |
| 563 | | * prefixed syntax symbol |
| 564 | | */ |
| 565 | | PrefixedSymbol(Id id, SyntaxSymbol symbol); |
| 566 | | /** |
| 567 | | * optional syntax symbol |
| 568 | | */ |
| 569 | | OptionalSymbol(SyntaxSymbol symbol); |
| 570 | | /** |
| 571 | | * repeat zero-or-more syntax symbol |
| 572 | | */ |
| 573 | | RepeatSymbol(SyntaxSymbol symbol); |
| 574 | | /** |
| 575 | | * repeat one-or-more syntax symbol |
| 576 | | */ |
| 577 | | RepeatOneOrMoreSymbol(SyntaxSymbol symbol); |
| 578 | | /** |
| 579 | | * ignore following whitespace syntax symbol |
| 580 | | */ |
| 581 | | NoWhitespaceSymbol(SyntaxSymbol symbol); |
| 582 | | /** |
| 583 | | * groups of symbols |
| 584 | | */ |
| 585 | | GroupSymbol(List<SyntaxSymbol> symbols); |
| 586 | | /** |
| 587 | | * special symbols syntax symbol |
| 588 | | */ |
| 589 | | abstract SpecialSymbol(); |
| 590 | | /** |
| 591 | | * any character syntax symbol |
| 592 | | */ |
| 593 | | AnyCharacterSymbol(); |
| 594 | | /** |
| 595 | | * whitespace syntax symbol |
| 596 | | */ |
| 597 | | WhitespaceSymbol(String s); |
| 598 | | /** |
| 599 | | * tab syntax symbol |
| 600 | | */ |
| 601 | | TabSymbol(); |
| 602 | | /** |
| 603 | | * formfeed syntax symbol |
| 604 | | */ |
| 605 | | FormfeedSymbol(); |
| 606 | | /** |
| 607 | | * carriage return syntax symbol |
| 608 | | */ |
| 609 | | CarriageReturnSymbol(); |
| 610 | | /** |
| 611 | | * backspace syntax symbol |
| 612 | | */ |
| 613 | | BackspaceSymbol(); |
| 614 | | /** |
| 615 | | * newline syntax symbol |
| 616 | | */ |
| 617 | | NewlineSymbol(); |
| 618 | | /** |
| 619 | | * breakline syntax symbol |
| 620 | | */ |
| 621 | | BreaklineSymbol(String s); |
| 622 | | /** |
| 623 | | * item syntax symbol; |
| 624 | | * may be either nonterminal or keyword |
| 625 | | */ |
| 626 | | ItemSymbol(String item); |
| 627 | | /** |
| 628 | | * non-terminal syntax symbol |
| 629 | | */ |
| 630 | | NonterminalSymbol(Id nonterminal); |
| 631 | | /** |
| 632 | | * keyword syntax symbol |
| 633 | | */ |
| 634 | | KeywordSymbol(String token); |
| 635 | | /** |
| 636 | | * token syntax symbol |
| 637 | | */ |
| 638 | | TokenSymbol(String token); |
| 639 | | /** |
| 640 | | * not predicate syntax symbol |
| 641 | | */ |
| 642 | | NotPredicateSymbol(SyntaxSymbol symbol); |
| 643 | | /** |
| 644 | | * and predicate syntax symbol |
| 645 | | */ |
| 646 | | AndPredicateSymbol(SyntaxSymbol symbol); |
| 647 | | /** |
| 648 | | * character class syntax symbol |
| 649 | | */ |
| 650 | | CharacterClassSymbol(List<CharacterSymbol> characters); |
| 651 | | /** |
| 652 | | * character symbols |
| 653 | | */ |
| 654 | | abstract CharacterSymbol(); |
| 655 | | /** |
| 656 | | * character |
| 657 | | */ |
| 658 | | CharSymbol(String string); |
| 659 | | /** |
| 660 | | * character interval |
| 661 | | */ |
| 662 | | CharacterInterval(String begin, String end); |