blob: 2f695a3b8f84db4dfc4074339dd7bd9d2285c4e2 [file] [log] [blame]
#######################################################################################################################
##
## LUDWIG GRAMMAR FOR FORTRAN 2008
##
#######################################################################################################################
##
## Copyright (c) 2009 University of Illinois at Urbana-Champaign and others.
## All rights reserved. This program and the accompanying materials
## are made available under the terms of the Eclipse Public License v1.0
## which accompanies this distribution, and is available at
## http://www.eclipse.org/legal/epl-v10.html
##
## Author: Jeffrey Overbey, based on an Eli grammar for Fortran 95
## by W.B. Clodius, W.M. Waite, J. Hoffmann, and R. Jakob
## available from http://members.aol.com/wclodius/Parse95.html
##
## The Eli grammar on which this is based is
## Copyright (c) <1999> <W. B. Clodius and W. M. Waite>
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation
## files (the "Software"), to deal in the Software without restriction,
## including without limitation the rights to use, copy, modify,
## merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software
## is furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
## OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
## HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
## WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS IN THE SOFTWARE.
##
## Changes:
## 08 Dec 2009 Jeff Overbey: Finished Fortran 2008 support
## 01 Dec 2009 Jeff Overbey: Started Fortran 2008 support
## 26 May 2009 Jeff Overbey: Bug fixes in Fortran 2003 support
## Jan 2009 Jeff Overbey: Finished Fortran 2003 support
## Aug 2008 Jeff Overbey: Started Fortran 2003 support
## 19 Apr 2005 Dirk Rossow: Added T_Hcon Hollerith Constants
## 19 Apr 2005 Dirk Rossow: Modified xUFPrimary with <xSubstringRange>
# Two conflicts are resolved manually in the parser spec file
# Last CVS version with optionals: 4.0.0 Beta 1 or Pre-LANL
#######################################################################################################################
# AST Customizations
#######################################################################################################################
# Inheritance rules
* ASTExecutableProgramNode(extends=ScopingNode)
* ASTMainProgramNode(extends=ScopingNode)
* ASTFunctionSubprogramNode(extends=ScopingNode)
* ASTSubroutineSubprogramNode(extends=ScopingNode)
* ASTSeparateModuleSubprogramNode(extends=ScopingNode)
* ASTModuleNode(extends=ScopingNode)
* ASTSubmoduleNode(extends=ScopingNode)
* ASTBlockDataSubprogramNode(extends=ScopingNode)
* ASTDerivedTypeDefNode(extends=ScopingNode)
* ASTBlockConstructNode(extends=ScopingNode)
* ASTInterfaceBlockNode(extends=ScopingNode)
* ASTIfThenStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTFormatStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTElseStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTSubroutineStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTSelectCaseStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTDataStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTElseIfStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTFunctionStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTCaseStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTForallConstructStmtNode(implements=IActionStmt,also-visit=IActionStmt)
* ASTPauseStmtNode(implements=IObsoleteActionStmt,also-visit=IObsoleteActionStmt)
* ASTAssignStmtNode(implements=IObsoleteActionStmt,also-visit=IObsoleteActionStmt)
# Custom code
* IActionStmt => Token getLabel(); void setLabel(Token label);
* ASTTypeSpecNode => public org.eclipse.photran.internal.core.lexer.Token getCharacterToken() { return this.isCharacter; }
* ASTEndFunctionStmtNode => public boolean hasEndFunction() { return hiddenTFunction != null || hiddenTEndfunction != null; }
* ASTEndModuleStmtNode => public boolean hasEndModule() { return hiddenTModule != null || hiddenTEndmodule != null; }
* ASTEndProgramStmtNode => public boolean hasEndProgram() { return hiddenTProgram != null || endToken.getTerminal() == Terminal.T_ENDPROGRAM; }
* ASTEndSubroutineStmtNode => public boolean hasEndSubroutine() { return hiddenTSubroutine != null || hiddenTEndsubroutine != null; }
# ASTSubroutineArgNode patched manually via ASTSubroutineArgNode.patch
#######################################################################################################################
# Section 2 Rules
#######################################################################################################################
# R201
<ExecutableProgram> ::=
<ProgramUnitList>
| <EmptyProgram>
# JO -- So empty files don't give a syntax error in the editor
<EmptyProgram> ::=
| (empty)
| -:T_EOS
(list):<ProgramUnitList> ::=
| <ProgramUnit>
| <ProgramUnitList> <ProgramUnit>
# R202
(superclass):<ProgramUnit> ::=
| <MainProgram>
| <FunctionSubprogram>
| <SubroutineSubprogram>
| <Module>
| <Submodule> # F08
| <BlockDataSubprogram>
| (error) T_EOS <= ASTErrorProgramUnitNode
# R203 chain rule eliminated
# R1101 doesn't ensure ordering as the standard requires
<MainProgram> ::=
| (inline):<MainRange>
| <ProgramStmt> (inline):<MainRange>
<MainRange> ::=
| <Body> <EndProgramStmt>
| (inline):<BodyPlusInternals> <EndProgramStmt>
| <EndProgramStmt>
(list):<Body> ::=
| <BodyConstruct>
| <Body> <BodyConstruct>
(superclass):<BodyConstruct> ::=
| <SpecificationPartConstruct>
| <ExecutableConstruct>
| (error) T_EOS <= ASTErrorConstructNode
# R203 chain rule omitted
#######################################################################################################################
# Section 12 Rules
#######################################################################################################################
# R1216
<FunctionSubprogram> ::=
<FunctionStmt> (inline):<FunctionRange>
<FunctionRange> ::=
| <Body> <EndFunctionStmt>
| <EndFunctionStmt>
| (inline):<BodyPlusInternals> <EndFunctionStmt>
# R1221
<SubroutineSubprogram> ::=
<SubroutineStmt> (inline):<SubroutineRange>
<SubroutineRange> ::=
| <Body> <EndSubroutineStmt>
| <EndSubroutineStmt>
| (inline):<BodyPlusInternals> <EndSubroutineStmt>
# F08 R1237
<SeparateModuleSubprogram> ::=
<MpSubprogramStmt> (inline):<MpSubprogramRange>
<MpSubprogramRange> ::=
| <Body> <EndMpSubprogramStmt>
| <EndMpSubprogramStmt>
| (inline):<BodyPlusInternals> <EndMpSubprogramStmt>
# F08 R1238
<MpSubprogramStmt> ::=
(inline):<LblDef> -:T_MODULE -:T_PROCEDURE procedureName:T_IDENT -:T_EOS
# F08 R1239
<EndMpSubprogramStmt> ::=
| (inline):<LblDef> -:T_END -:T_EOS
| (inline):<LblDef> -:T_ENDPROCEDURE -:T_EOS
| (inline):<LblDef> -:T_ENDPROCEDURE (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_PROCEDURE -:T_EOS
| (inline):<LblDef> -:T_END -:T_PROCEDURE (inline):<EndName> -:T_EOS
#######################################################################################################################
# Section 11 Rules
#######################################################################################################################
# R1104
<Module> ::=
<ModuleStmt> (inline):<ModuleBlock>
<ModuleBlock> ::=
| <ModuleBody> <EndModuleStmt>
| <EndModuleStmt>
#(list):<ModuleBody> ::=
# | <SpecificationPartConstruct>
# | <ModuleSubprogramPartConstruct>
# | <ModuleBody> <SpecificationPartConstruct>
# | <ModuleBody> <ModuleSubprogramPartConstruct>
#JO--X
(list):<ModuleBody> ::=
| <ModuleBody> <ModuleBodyConstruct>
| <ModuleBodyConstruct>
(superclass):<ModuleBodyConstruct> ::=
| <SpecificationPartConstruct>
| <ModuleSubprogramPartConstruct>
# F08 R1116
<Submodule> ::=
<SubmoduleStmt> (inline):<SubmoduleBlock>
<SubmoduleBlock> ::=
| <ModuleBody> <EndSubmoduleStmt>
| <EndSubmoduleStmt>
# F08 R1117
<SubmoduleStmt> ::=
(inline):<LblDef> -:T_SUBMODULE -:T_LPAREN <ParentIdentifier> -:T_RPAREN submoduleName:<ModuleName> -:T_EOS
# F08 R1118
<ParentIdentifier> ::=
ancestorModuleName:<ModuleName>
| ancestorModuleName:<ModuleName> -:T_COLON parentSubmoduleName:<ModuleName>
# F08 R1119
<EndSubmoduleStmt> ::=
| (inline):<LblDef> -:T_END -:T_EOS
| (inline):<LblDef> -:T_ENDSUBMODULE -:T_EOS
| (inline):<LblDef> -:T_ENDSUBMODULE (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_SUBMODULE -:T_EOS
| (inline):<LblDef> -:T_END -:T_SUBMODULE (inline):<EndName> -:T_EOS
# R1112
<BlockDataSubprogram> ::=
| <BlockDataStmt> <BlockDataBody> <EndBlockDataStmt>
| <BlockDataStmt> <EndBlockDataStmt>
(list):<BlockDataBody> ::=
| <BlockDataBodyConstruct>
| <BlockDataBody> <BlockDataBodyConstruct>
(superclass):<BlockDataBodyConstruct> ::=
<SpecificationPartConstruct>
#######################################################################################################################
# Section 2 Rules, continued
#######################################################################################################################
# R204 doesn't ensure ordering as the standard requires
(superclass):<SpecificationPartConstruct> ::=
| <UseStmt>
| <ImportStmt> # F03
| <ImplicitStmt>
| <ParameterStmt>
| <FormatStmt>
| <EntryStmt>
| <DeclarationConstruct>
# R205 see R204
# R206 see R204
# R207 also see R204
(superclass):<DeclarationConstruct> ::=
| <DerivedTypeDef>
| <EnumDef> # F03
| <InterfaceBlock>
| <TypeDeclarationStmt>
| <SpecificationStmt>
| <ProcedureDeclarationStmt> # F03
# R208
# R209
(superclass):<ExecutionPartConstruct> ::=
| <ObsoleteExecutionPartConstruct>
| <ExecutableConstruct>
| <FormatStmt>
| <EntryStmt>
(superclass):<ObsoleteExecutionPartConstruct> ::= <DataStmt>
## R210
#(list):<BodyPlusInternals> ::=
# | <Body> <ContainsStmt> <InternalSubprogram>
# | <ContainsStmt> <InternalSubprogram>
# | <BodyPlusInternals> <InternalSubprogram>
#JO--Y
# R210
<BodyPlusInternals> ::=
| <Body> <ContainsStmt> <InternalSubprograms>
| <ContainsStmt> <InternalSubprograms>
(list):<InternalSubprograms> ::=
| <InternalSubprogram>
| <InternalSubprograms> <InternalSubprogram>
# R211
(superclass):<InternalSubprogram> ::=
| <FunctionSubprogram>
| <SubroutineSubprogram>
# R212 doesn't ensure ordering as standard requires
(superclass):<ModuleSubprogramPartConstruct> ::=
| <ContainsStmt>
| <ModuleSubprogram>
| <SeparateModuleSubprogram> # F08
# R213
(superclass):<ModuleSubprogram> ::=
| <FunctionSubprogram>
| <SubroutineSubprogram>
# R214
(superclass):<SpecificationStmt> ::=
| <AccessStmt>
| <AllocatableStmt>
| <AsynchronousStmt> # F03
| <BindStmt> # F03
| <CodimensionStmt> # F08
| <CommonStmt>
| <ContiguousStmt> # F08
| <DataStmt>
| <DimensionStmt>
| <EquivalenceStmt>
| <ExternalStmt>
| <IntentStmt>
| <IntrinsicStmt>
| <NamelistStmt>
| <OptionalStmt>
| <PointerStmt>
| <CrayPointerStmt> # JO
| <ProtectedStmt> # F03
| <SaveStmt>
| <TargetStmt>
| <VolatileStmt> # F03
| <ValueStmt> # F03
| <UnprocessedIncludeStmt>
#JO
<UnprocessedIncludeStmt> ::=
(inline):<LblDef> T_IDENT T_SCON T_EOS
# R215
(superclass):<ExecutableConstruct> ::=
| <ActionStmt>
| <AssociateConstruct> # F03
| <BlockConstruct> # F08
| <CaseConstruct>
| <CriticalConstruct> # F08
| <DoConstruct>
| <ForallConstruct>
| <IfConstruct>
| <SelectTypeConstruct> # F03
| <WhereConstruct>
| <EndDoStmt>
# see the note on R818
# R216
(superclass):<ActionStmt> ::=
| <ObsoleteActionStmt>
| <AllocateStmt>
| <AllStopStmt> # F08
| <AssignmentStmt>
| <BackspaceStmt>
| <CallStmt>
| <CloseStmt>
| <ContinueStmt>
| <CycleStmt>
| <DeallocateStmt>
| <EndfileStmt>
| <ExitStmt>
| <ForallStmt>
| <GotoStmt>
| <IfStmt>
| <InquireStmt>
| <LockStmt> # F08
| <NullifyStmt>
| <OpenStmt>
| <PointerAssignmentStmt>
| <PrintStmt>
| <ReadStmt>
| <ReturnStmt>
| <RewindStmt>
| <StopStmt>
| <SyncAllStmt> # F08
| <SyncImagesStmt> # F08
| <SyncMemoryStmt> # F08
| <UnlockStmt> # F08
| <WaitStmt> # F03
| <WhereStmt>
| <WriteStmt>
#(superclass):<ActionStmt> ::=
| <AssignStmt>
| <AssignedGotoStmt>
| <PauseStmt>
(superclass):<ObsoleteActionStmt> ::=
| <StmtFunctionStmt>
| <ArithmeticIfStmt>
| <ComputedGotoStmt>
#######################################################################################################################
# Section 3 Rules
#######################################################################################################################
# R301-R303 are components of symbols recognized by the lexical analyzer
# R304 recognized by the lexical analyzer as T_ICON Is this different in F90?
<Name> ::= Name:T_IDENT
# R305
# Dirk Rossow added T_HCON
<Constant> ::=
| name:<NamedConstantUse>
| <UnsignedArithmeticConstant>
| hasPlus(bool):T_PLUS <UnsignedArithmeticConstant>
| hasMinus(bool):T_MINUS <UnsignedArithmeticConstant>
| stringConst:T_SCON
| hasIntKind(bool):T_ICON -:T_UNDERSCORE stringConst:T_SCON
| namedConstantKind:<NamedConstantUse> -:T_UNDERSCORE stringConst:T_SCON
| logicalConst:<LogicalConstant>
| <StructureConstructor>
| <BozLiteralConstant>
| hollerithConst:T_HCON
# R306 chain rule deleted
# R307
<NamedConstant> ::= namedConstant:T_IDENT
<NamedConstantUse> ::= name:T_IDENT
# R308 chain rule deleted
# R309 chain rule deleted
# R310 recognized semantically
#######################################################################################################################
# Section 7 Rules and R311-R313
#######################################################################################################################
# R708
ASTOperatorNode:<PowerOp> ::= hasPowerOp(bool):T_POW
# R709
ASTOperatorNode:<MultOp> ::=
| hasTimesOp(bool):T_ASTERISK
| hasDivideOp(bool):T_SLASH
# R710
ASTOperatorNode:<AddOp> ::=
| hasPlusOp(bool):T_PLUS
| hasMinusOp(bool):T_MINUS
<Sign> ::=
hasPlusSign(bool):T_PLUS
| hasMinusSign(bool):T_MINUS
# R712
ASTOperatorNode:<ConcatOp> ::= hasConcatOp(bool):T_SLASHSLASH
# R714
ASTOperatorNode:<RelOp> ::=
| hasEqOp(bool):T_EQ
| hasNeOp(bool):T_NE
| hasLtOp(bool):T_LT
| hasLtOp(bool):T_LESSTHAN
| hasLeOp(bool):T_LE
| hasLeOp(bool):T_LESSTHANEQ
| hasGtOp(bool):T_GT
| hasGtOp(bool):T_GREATERTHAN
| hasGeOp(bool):T_GE
| hasGeOp(bool):T_GREATERTHANEQ
| hasEqEqOp(bool):T_EQEQ
| hasSlashEqOp(bool):T_SLASHEQ
# R719
ASTOperatorNode:<NotOp> ::= hasNotOp(bool):T_NOT
# R720
ASTOperatorNode:<AndOp> ::= hasAndOp(bool):T_AND
# R721
ASTOperatorNode:<OrOp> ::= hasOrOp(bool):T_OR
# R722
ASTOperatorNode:<EquivOp> ::=
| hasEqvOp(bool):T_EQV
| hasNeqvOp(bool):T_NEQV
# R311
(superclass):<DefinedOperator> ::=
| customDefinedOp:T_XDOP <= ASTOperatorNode
| <ConcatOp>
| <PowerOp>
| <MultOp>
| <AddOp>
| <RelOp>
| <NotOp>
| <AndOp>
| <OrOp>
| <EquivOp>
# R704
ASTOperatorNode:<DefinedUnaryOp> ::=
definedUnaryOp:T_XDOP
# R724
ASTOperatorNode:<DefinedBinaryOp> ::=
definedBinaryOp:T_XDOP
# R312 recognized semantically
# R313 recognized by the lexical analyzer as T_ICON
<Label> ::=
label:T_ICON
#######################################################################################################################
# Section 4 Rules
#######################################################################################################################
# R401 recognized by the lexical analyzer in the context of R413
# R402 recognized by the lexical analyzer in the context of R413, T_ICON
# R403 chain rule deleted see R305
# R404
IUnsignedArithmeticConst(superclass):<UnsignedArithmeticConstant> ::=
| intConst:T_ICON <= ASTIntConstNode
| realConst:T_RCON <= ASTRealConstNode
| dblConst:T_DCON <= ASTDblConstNode
| complexConst:<ComplexConst>
| intConst:T_ICON -:T_UNDERSCORE UnsignedArithConst(inline):<KindParam> <= ASTIntConstNode
| realConst:T_RCON -:T_UNDERSCORE UnsignedArithConst(inline):<KindParam> <= ASTRealConstNode
| dblConst:T_DCON -:T_UNDERSCORE UnsignedArithConst(inline):<KindParam> <= ASTDblConstNode
# R405
<KindParam> ::=
| intKind:T_ICON
| namedConstKind:<NamedConstantUse>
# R406 see R305
# R407
ASTBozLiteralConstNode:<BozLiteralConstant> ::=
| binaryConst:T_BCON
| octalConst:T_OCON
| hexConst:T_ZCON
# R408 recognized by the lexical analyzer as T_BCON
# R409 recognized by the lexical analyzer as T_OCON
# R410 recognized by the lexical analyzer as T_ZCON
# R411 component of a symbol recognized by the lexical analyzer
# R412 see R404
# R413 see R404
# R414-R416 components of symbols recognized by the lexical analyzer
# R417
<ComplexConst> ::= -:T_LPAREN real-part:<Expr> -:T_COMMA complex-part:<Expr> -:T_RPAREN
# R418 chain rule deleted
# R419 chain rule deleted
# R420 chain rule deleted see R305
# R421
ASTLogicalConstNode:<LogicalConstant> ::=
| isTrue(bool):T_TRUE
| isFalse(bool):T_FALSE
| isTrue(bool):T_TRUE -:T_UNDERSCORE (inline):<KindParam>
| isFalse(bool):T_FALSE -:T_UNDERSCORE (inline):<KindParam>
# R422 This does not enforce the required sequence
#<DerivedTypeDef> ::=
# <DerivedTypeStmt> <DerivedTypeBody> <EndTypeStmt>
# R422 -- F03 R429 # TODO: Note ... in spec -- need to fix!
<DerivedTypeDef> ::=
# (1)--------------- (2)-------------- (3)---------------------
| <DerivedTypeStmt> <EndTypeStmt>
| <DerivedTypeStmt> <TypeBoundProcedurePart> <EndTypeStmt>
| <DerivedTypeStmt> <DerivedTypeBody> <EndTypeStmt>
| <DerivedTypeStmt> <DerivedTypeBody> <TypeBoundProcedurePart> <EndTypeStmt>
| <DerivedTypeStmt> <TypeParamDefStmt> <EndTypeStmt>
| <DerivedTypeStmt> <TypeParamDefStmt> <TypeBoundProcedurePart> <EndTypeStmt>
| <DerivedTypeStmt> <TypeParamDefStmt> <DerivedTypeBody> <EndTypeStmt>
| <DerivedTypeStmt> <TypeParamDefStmt> <DerivedTypeBody> <TypeBoundProcedurePart> <EndTypeStmt>
(list):<DerivedTypeBody> ::=
| <DerivedTypeBodyConstruct>
| <DerivedTypeBody> <DerivedTypeBodyConstruct>
(superclass):<DerivedTypeBodyConstruct> ::=
| <PrivateSequenceStmt>
| <ComponentDefStmt>
## R423
#<DerivedTypeStmt> ::=
# | (inline):<LblDef> -:T_TYPE (inline):<TypeName> -:T_EOS
# | (inline):<LblDef> -:T_TYPE -:T_COLON -:T_COLON (inline):<TypeName> -:T_EOS
# | (inline):<LblDef> -:T_TYPE -:T_COMMA <AccessSpec> -:T_COLON -:T_COLON (inline):<TypeName> -:T_EOS
# R423 -- F03 R430
<DerivedTypeStmt> ::=
| (inline):<LblDef> -:T_TYPE (inline):<TypeName> -:T_EOS
| (inline):<LblDef> -:T_TYPE -:T_COLON -:T_COLON (inline):<TypeName> -:T_EOS
| (inline):<LblDef> -:T_TYPE -:T_COMMA <TypeAttrSpecList> -:T_COLON -:T_COLON (inline):<TypeName> -:T_EOS
| (inline):<LblDef> -:T_TYPE (inline):<TypeName> -:T_LPAREN <TypeParamNameList> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_TYPE -:T_COLON -:T_COLON (inline):<TypeName> -:T_LPAREN <TypeParamNameList> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_TYPE -:T_COMMA <TypeAttrSpecList> -:T_COLON -:T_COLON (inline):<TypeName> -:T_LPAREN <TypeParamNameList> -:T_RPAREN -:T_EOS
(list):<TypeParamNameList> ::= <TypeParamNameList> -:T_COMMA <TypeParamName> | <TypeParamName>
(list):<TypeAttrSpecList> ::= <TypeAttrSpecList> -:T_COMMA <TypeAttrSpec> | <TypeAttrSpec>
# F03 R431
<TypeAttrSpec> ::=
| <AccessSpec>
| is-extends(bool):T_EXTENDS -:T_LPAREN parent-type-name:T_IDENT -:T_RPAREN
| is-abstract(bool):T_ABSTRACT
| is-bind(bool):T_BIND -:T_LPAREN language:T_IDENT -:T_RPAREN
<TypeParamName> ::= type-param-name:T_IDENT
# R424
<PrivateSequenceStmt> ::=
| (inline):<LblDef> privateToken:T_PRIVATE isPrivate(bool):T_EOS
| (inline):<LblDef> sequenceToken:T_SEQUENCE isSequence(bool):T_EOS
# F03 R435
<TypeParamDefStmt> ::=
# | (inline):<LblDef> -:T_INTEGER -:T_COMMA <TypeParamAttrSpec> -:T_COLON -:T_COLON <TypeParamDeclList> -:T_EOS
# | (inline):<LblDef> -:T_INTEGER <KindSelector> -:T_COMMA <TypeParamAttrSpec> -:T_COLON -:T_COLON <TypeParamDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> -:T_COMMA <TypeParamAttrSpec> -:T_COLON -:T_COLON <TypeParamDeclList> -:T_EOS
# F03 R436
(list):<TypeParamDeclList> ::= <TypeParamDeclList> -:T_COMMA <TypeParamDecl> | <TypeParamDecl>
<TypeParamDecl> ::=
| type-param-name:T_IDENT
| type-param-name:T_IDENT -:T_EQUALS <Expr>
# F03 R437
<TypeParamAttrSpec> ::= isKind(bool):T_KIND | isLen(bool):T_LEN
## R425
#<ComponentDefStmt> ::=
# | (inline):<LblDef> <TypeSpec> -:T_COMMA <ComponentAttrSpecList> -:T_COLON -:T_COLON <ComponentDeclList> -:T_EOS
# | (inline):<LblDef> <TypeSpec> -:T_COLON -:T_COLON <ComponentDeclList> -:T_EOS
# | (inline):<LblDef> <TypeSpec> <ComponentDeclList> -:T_EOS
# F03 R439
(superclass):<ComponentDefStmt> ::=
| <DataComponentDefStmt>
| <ProcComponentDefStmt>
# R425 F03 R440
<DataComponentDefStmt> ::=
| (inline):<LblDef> <TypeSpec> -:T_COMMA <ComponentAttrSpecList> -:T_COLON -:T_COLON <ComponentDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> -:T_COLON -:T_COLON <ComponentDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> <ComponentDeclList> -:T_EOS
# R426
(list):<ComponentAttrSpecList> ::=
| <ComponentAttrSpec>
| <ComponentAttrSpecList> -:T_COMMA <ComponentAttrSpec>
<ComponentAttrSpec> ::=
| pointer(bool):T_POINTER
| dimension(bool):T_DIMENSION -:T_LPAREN <ComponentArraySpec> -:T_RPAREN
# JO -- Added these
| allocatable(bool):T_ALLOCATABLE
| <AccessSpec>
| codimension(bool):T_CODIMENSION -:T_LBRACKET <CoarraySpec> -:T_RBRACKET # F08
| contiguous(bool):T_CONTIGUOUS
# R427
<ComponentArraySpec> ::=
| <ExplicitShapeSpecList>
| <DeferredShapeSpecList>
# R428
(list):<ComponentDeclList> ::=
| <ComponentDecl>
| <ComponentDeclList> -:T_COMMA <ComponentDecl>
<ComponentDecl> ::=
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_ASTERISK <CharLength> <ComponentInitialization>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_ASTERISK <CharLength>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN <ComponentInitialization>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN
| <ComponentName> -:T_ASTERISK <CharLength> <ComponentInitialization>
| <ComponentName> -:T_ASTERISK <CharLength>
| <ComponentName> <ComponentInitialization>
| <ComponentName>
# F08
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength> <ComponentInitialization>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET <ComponentInitialization>
| <ComponentName> -:T_LPAREN <ComponentArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
| <ComponentName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength> <ComponentInitialization>
| <ComponentName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength>
| <ComponentName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET <ComponentInitialization>
| <ComponentName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
# R429
<ComponentInitialization> ::=
| assignsExpr(bool):T_EQUALS assignedExpr:<Expr>
| assignsNull(bool):T_EQGREATERTHAN -:T_NULL -:T_LPAREN -:T_RPAREN
# R430
<EndTypeStmt> ::=
| (inline):<LblDef> -:T_ENDTYPE <TypeName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_TYPE <TypeName> -:T_EOS
| (inline):<LblDef> -:T_ENDTYPE -:T_EOS
| (inline):<LblDef> -:T_END -:T_TYPE -:T_EOS
# F03 R445
<ProcComponentDefStmt> ::=
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN <ProcInterface> -:T_RPAREN -:T_COMMA <ProcComponentAttrSpecList> -:T_COLON -:T_COLON <ProcDeclList> -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN -:T_RPAREN -:T_COMMA <ProcComponentAttrSpecList> -:T_COLON -:T_COLON <ProcDeclList> -:T_EOS
# F03 R1212
<ProcInterface> ::=
| interfaceName:T_IDENT
| <TypeSpec>
# F03 R1214
(list):<ProcDeclList> ::= <ProcDeclList> -:T_COMMA <ProcDecl> | <ProcDecl>
<ProcDecl> ::=
| procedureEntityName:T_IDENT
| procedureEntityName:T_IDENT -:T_EQGREATERTHAN assignsNull(bool):T_NULL -:T_LPAREN -:T_RPAREN
# F03 R446
(list):<ProcComponentAttrSpecList> ::= <ProcComponentAttrSpecList> -:T_COMMA <ProcComponentAttrSpec> | <ProcComponentAttrSpec>
<ProcComponentAttrSpec> ::=
| isPointer(bool):T_POINTER
| isPass(bool):T_PASS
| isPass(bool):T_PASS -:T_LPAREN argName:T_IDENT -:T_RPAREN
| isNoPass(bool):T_NOPASS
| <AccessSpec>
# F03 R448
<TypeBoundProcedurePart> ::=
| <ContainsStmt> <BindingPrivateStmt> <ProcBindingStmts>
| <ContainsStmt> <ProcBindingStmts>
# F03 R449
<BindingPrivateStmt> ::=
(inline):<LblDef> privateToken:T_PRIVATE isPrivate(bool):T_EOS
# F03 R450
(list):<ProcBindingStmts> ::=
<ProcBindingStmts> <ProcBindingStmt> | <ProcBindingStmt>
(superclass):<ProcBindingStmt> ::=
| <SpecificBinding>
| <GenericBinding>
| <FinalBinding>
# F03 R451
<SpecificBinding> ::=
# 1111111111111111111111111111111111111111111 22222222222222222222222222222222222222222222222 333333333333333333333333333333333333333
| (inline):<LblDef> -:T_PROCEDURE bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
# | (inline):<LblDef> -:T_PROCEDURE -:T_COMMA <BindingAttrList> bindingName:T_IDENT -:T_EOS
# | (inline):<LblDef> -:T_PROCEDURE -:T_COMMA <BindingAttrList> bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_COMMA <BindingAttrList> -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_COMMA <BindingAttrList> -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
# | (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COMMA <BindingAttrList> bindingName:T_IDENT -:T_EOS
# | (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COMMA <BindingAttrList> bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COMMA <BindingAttrList> -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EOS
| (inline):<LblDef> -:T_PROCEDURE -:T_LPAREN interfaceName:T_IDENT -:T_RPAREN -:T_COMMA <BindingAttrList> -:T_COLON -:T_COLON bindingName:T_IDENT -:T_EQGREATERTHAN procedureName:T_IDENT -:T_EOS
# F03 R452
<GenericBinding> ::=
| (inline):<LblDef> -:T_GENERIC -:T_COMMA <AccessSpec> -:T_COLON -:T_COLON <GenericSpec> -:T_EQGREATERTHAN <BindingNameList> -:T_EOS
| (inline):<LblDef> -:T_GENERIC -:T_COLON -:T_COLON <GenericSpec> -:T_EQGREATERTHAN <BindingNameList> -:T_EOS
| (inline):<LblDef> -:T_GENERIC -:T_COMMA <AccessSpec> -:T_COLON -:T_COLON <GenericName> -:T_EQGREATERTHAN <BindingNameList> -:T_EOS
| (inline):<LblDef> -:T_GENERIC -:T_COLON -:T_COLON <GenericName> -:T_EQGREATERTHAN <BindingNameList> -:T_EOS
(list):<BindingNameList> ::= <BindingNameList> -:T_COMMA T_IDENT | T_IDENT
# F03 R453
(list):<BindingAttrList> ::= <BindingAttrList> -:T_COMMA <BindingAttr> | <BindingAttr>
<BindingAttr> ::=
| isPass(bool):T_PASS
| isPass(bool):T_PASS -:T_LPAREN argName:T_IDENT -:T_RPAREN
| isNoPass(bool):T_NOPASS
| isNonOverridable(bool):T_NON_OVERRIDABLE
| isDeferred(bool):T_DEFERRED
| <AccessSpec>
# F03 R454
<FinalBinding> ::=
| (inline):<LblDef> -:T_FINAL -:T_COLON -:T_COLON <FinalSubroutineNameList> -:T_EOS
| (inline):<LblDef> -:T_FINAL <FinalSubroutineNameList> -:T_EOS
(list):<FinalSubroutineNameList> ::= <FinalSubroutineNameList> -:T_COMMA T_IDENT | T_IDENT
# R431 -- F03 R457
#<StructureConstructor> ::= <TypeName> -:T_LPAREN <ExprList> -:T_RPAREN
# Manually inlined <DerivedTypeSpec> to resolve S/R conflict
# Used <TypeParamSpecList> for list of [<Name>=]<Expr> pairs to resolve R/R conflict
#<StructureConstructor> ::= (inline):<DerivedTypeSpec> -:T_LPAREN <AssignedExprList> -:T_RPAREN
<StructureConstructor> ::=
| (inline):<TypeName> -:T_LPAREN <TypeParamSpecList> -:T_RPAREN
| (inline):<TypeName> -:T_LPAREN <TypeParamSpecList> -:T_RPAREN -:T_LPAREN <TypeParamSpecList> -:T_RPAREN
#(list):<ExprList> ::=
# | <Expr>
# | <ExprList> -:T_COMMA <Expr>
# F03 R460
<EnumDef> ::= <EnumDefStmt> <EnumeratorDefStmts> <EndEnumStmt>
(list):<EnumeratorDefStmts> ::= <EnumeratorDefStmts> <EnumeratorDefStmt> | <EnumeratorDefStmt>
# F03 R461
<EnumDefStmt> ::=
(inline):<LblDef> -:T_ENUM -:T_COMMA -:T_BIND -:T_LPAREN -:T_IDENT -:T_RPAREN -:T_EOS
# F03 R462
<EnumeratorDefStmt> ::=
| (inline):<LblDef> -:T_ENUMERATOR <EnumeratorList> -:T_EOS
| (inline):<LblDef> -:T_ENUMERATOR -:T_COLON -:T_COLON <EnumeratorList> -:T_EOS
# F03 R463
<Enumerator> ::=
| <NamedConstant>
| <NamedConstant> -:T_EQUALS <Expr>
(list):<EnumeratorList> ::= <EnumeratorList> -:T_COMMA <Enumerator> | <Enumerator>
# F03 R464
<EndEnumStmt> ::=
(inline):<LblDef> -:T_END -:T_ENUM -:T_EOS
# R432 -- F03 R465, R466
# TODO -- <TypeSpecNoPrefix> -:T_COLON -:T_COLON leads to tricky conflicts -- fix later
#<ArrayConstructor> ::= -:T_LPARENSLASH <AcValueList> -:T_SLASHRPAREN
<ArrayConstructor> ::=
# | -:T_LPARENSLASH <TypeSpecNoPrefix> -:T_COLON -:T_COLON <AcValueList> -:T_SLASHRPAREN
# | -:T_LPARENSLASH <TypeSpecNoPrefix> -:T_COLON -:T_COLON -:T_SLASHRPAREN
| -:T_LPARENSLASH <AcValueList> -:T_SLASHRPAREN
# | -:T_LBRACKET <TypeSpecNoPrefix> -:T_COLON -:T_COLON <AcValueList> -:T_RBRACKET
# | -:T_LBRACKET <TypeSpecNoPrefix> -:T_COLON -:T_COLON -:T_RBRACKET
| -:T_LBRACKET <AcValueList> -:T_RBRACKET
## R433 Why <AcValueList1>?
#(superclass):<AcValueList> ::=
# | <Expr>
# | <AcValueList1>
#
#(list):<AcValueList1> ::=
# | <Expr> -:T_COMMA expr2:<Expr>
# | <Expr> -:T_COMMA <AcImpliedDo>
# | <AcImpliedDo>
# | <AcValueList1> -:T_COMMA <Expr>
# | <AcValueList1> -:T_COMMA <AcImpliedDo>
#JO--X
# R433
(list):<AcValueList> ::=
| <AcValue>
| <AcValueList> -:T_COMMA <AcValue>
<AcValue> ::=
| <Expr>
| <AcImpliedDo>
# R434
<AcImpliedDo> ::=
| -:T_LPAREN <Expr> -:T_COMMA <ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_RPAREN
| -:T_LPAREN <Expr> -:T_COMMA <ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_COMMA step:<Expr> -:T_RPAREN
| -:T_LPAREN nestedImpliedDo:<AcImpliedDo> -:T_COMMA <ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_RPAREN
| -:T_LPAREN nestedImpliedDo:<AcImpliedDo> -:T_COMMA <ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_COMMA step:<Expr> -:T_RPAREN
# R435 chain rule deleted
# R436 chain rule deleted
#######################################################################################################################
# Section 5 Rules
#######################################################################################################################
# R501
<TypeDeclarationStmt> ::=
| (inline):<LblDef> <TypeSpec> <AttrSpecSeq> -:T_COLON -:T_COLON <EntityDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> -:T_COLON -:T_COLON <EntityDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> <EntityDeclList> -:T_EOS
| (inline):<LblDef> <TypeSpec> -:T_COMMA <EntityDeclList> -:T_EOS # JO -- This is an extension
| (inline):<LblDef> <TypeSpec> (error) T_EOS
(list):<AttrSpecSeq> ::=
| -:T_COMMA <AttrSpec>
| <AttrSpecSeq> -:T_COMMA <AttrSpec>
# R502 -- N.B. This is "declaration-type-spec" in the Fortran 2003 grammar, and
# Fortran 2003's "type-spec" is <TypeSpecNoPrefix> in this grammar
ASTTypeSpecNode:<TypeSpec> ::=
| isInteger(bool):T_INTEGER
| isReal(bool):T_REAL
| isDblComplex(bool):T_DOUBLECOMPLEX # JO This is an extension
| isDouble(bool):T_DOUBLEPRECISION
| isComplex(bool):T_COMPLEX
| isLogical(bool):T_LOGICAL
| isCharacter(bool):T_CHARACTER
| isInteger(bool):T_INTEGER <KindSelector>
| isReal(bool):T_REAL <KindSelector>
| isDouble(bool):T_DOUBLE -:T_PRECISION
| isComplex(bool):T_COMPLEX <KindSelector>
| isDblComplex(bool):T_DOUBLE -:T_COMPLEX # JO This is an extension
| isCharacter(bool):T_CHARACTER <CharSelector>
| isLogical(bool):T_LOGICAL <KindSelector>
# | isDerivedType(bool):T_TYPE -:T_LPAREN (inline):<TypeName> -:T_RPAREN
# F03 R502
| isDerivedType(bool):T_TYPE -:T_LPAREN (inline):<DerivedTypeSpec> -:T_RPAREN
| isDerivedType(bool):T_CLASS -:T_LPAREN (inline):<DerivedTypeSpec> -:T_RPAREN
| isDerivedType(bool):T_CLASS -:T_LPAREN isAsterisk(bool):T_ASTERISK -:T_RPAREN
# F03 R401 -- see notes above for <TypeSpec>
ASTTypeSpecNode:<TypeSpecNoPrefix> ::=
| isInteger(bool):T_INTEGER
| isReal(bool):T_REAL
| isDblComplex(bool):T_DOUBLECOMPLEX # JO This is an extension
| isDouble(bool):T_DOUBLEPRECISION
| isComplex(bool):T_COMPLEX
| isLogical(bool):T_LOGICAL
| isCharacter(bool):T_CHARACTER
| isInteger(bool):T_INTEGER <KindSelector>
| isReal(bool):T_REAL <KindSelector>
| isDblComplex(bool):T_DOUBLE -:T_COMPLEX # JO This is an extension
| isDouble(bool):T_DOUBLE -:T_PRECISION
| isComplex(bool):T_COMPLEX <KindSelector>
| isCharacter(bool):T_CHARACTER <CharSelector>
| isLogical(bool):T_LOGICAL <KindSelector>
| (inline):<DerivedTypeSpec>
# F03 R455
<DerivedTypeSpec> ::=
| (inline):<TypeName>
| (inline):<TypeName> hiddenLParen2(omit):T_LPAREN <TypeParamSpecList> hiddenRParen2(omit):T_RPAREN
# F03 R456
(list):<TypeParamSpecList> ::=
| <TypeParamSpec>
| <TypeParamSpecList> -:T_COMMA <TypeParamSpec>
<TypeParamSpec> ::=
| <Name> -:T_EQUALS <TypeParamValue>
| <TypeParamValue>
# F03 R402
<TypeParamValue> ::=
| <Expr>
| isAsterisk(bool):T_ASTERISK
| isColon(bool):T_COLON
# R503
ASTAttrSpecNode:<AttrSpec> ::=
| <AccessSpec>
| isParameter(bool):T_PARAMETER
| isAllocatable(bool):T_ALLOCATABLE
| isDimension(bool):T_DIMENSION -:T_LPAREN <ArraySpec> -:T_RPAREN
| isExternal(bool):T_EXTERNAL
| isIntent(bool):T_INTENT -:T_LPAREN <IntentSpec> -:T_RPAREN
| isIntrinsic(bool):T_INTRINSIC
| isOptional(bool):T_OPTIONAL
| isPointer(bool):T_POINTER
| isSave(bool):T_SAVE
| isTarget(bool):T_TARGET
# F03 R503
| isAsync(bool):T_ASYNCHRONOUS
| isProtected(bool):T_PROTECTED
| isValue(bool):T_VALUE
| isVolatile(bool):T_VOLATILE
| <LanguageBindingSpec>
# F08 R502
| isCodimension(bool):T_CODIMENSION -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
| isContiguous(bool):T_CONTIGUOUS
# F03 R509
<LanguageBindingSpec> ::= # BIND(C) or BIND(C, NAME=expr)
| is-bind(bool):T_BIND -:T_LPAREN language:T_IDENT -:T_RPAREN
| is-bind(bool):T_BIND -:T_LPAREN language:T_IDENT -:T_COMMA -:T_IDENT -:T_EQUALS <Expr> -:T_RPAREN
# R504
(list):<EntityDeclList> ::=
| <EntityDecl>
| <EntityDeclList> -:T_COMMA <EntityDecl>
<EntityDecl> ::=
| <ObjectName>
| <ObjectName> <Initialization>
| <ObjectName> -:T_ASTERISK <CharLength>
| <ObjectName> -:T_ASTERISK <CharLength> <Initialization>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN <Initialization>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_ASTERISK <CharLength>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_ASTERISK <CharLength> <Initialization>
| (inline):<InvalidEntityDecl>
# F08 R503
| <ObjectName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
| <ObjectName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET <Initialization>
| <ObjectName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength>
| <ObjectName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength> <Initialization>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET <Initialization>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength>
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET -:T_ASTERISK <CharLength> <Initialization>
# Extension supported by gfortran and IBM XL Fortran (see Bug 294055)
# This actually accepts a superset (allowing multiple "a /.true./" declarations) but is close enough
| <ObjectName> -:T_SLASH <DataStmtValueList> -:T_SLASH
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_SLASH <DataStmtValueList> -:T_SLASH
| <ObjectName> -:T_ASTERISK <CharLength> -:T_SLASH <DataStmtValueList> -:T_SLASH
| <ObjectName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_ASTERISK <CharLength> -:T_SLASH <DataStmtValueList> -:T_SLASH
# JO -- Added error production
<InvalidEntityDecl> ::=
| <ObjectName> asterisk2(omit):T_ASTERISK initial-char-length:<CharLength> lparen2(omit):T_LPAREN <ArraySpec> rparen2(omit):T_RPAREN
| <ObjectName> asterisk2(omit):T_ASTERISK initial-char-length:<CharLength> lparen2(omit):T_LPAREN <ArraySpec> rparen2(omit):T_RPAREN <Initialization>
# R505
<Initialization> ::=
| assignsExpr(bool):T_EQUALS assignedExpr:<Expr>
| assignsNull(bool):T_EQGREATERTHAN -:T_NULL -:T_LPAREN -:T_RPAREN
# R506 Should this be 'kind=' or 'kind' '='?
<KindSelector> ::=
-:T_LPAREN -:T_KINDEQ kindExpr:<Expr> -:T_RPAREN
| -:T_LPAREN kindExpr:<Expr> -:T_RPAREN
| -:T_ASTERISK kindExpr:<Expr> # JO -- This is an extension
## R507
#<CharSelector> ::=
# | (inline):<LengthSelector>
# | -:T_LPAREN T_LENEQ <CharLenParamValue> -:T_COMMA T_KINDEQ <Expr> -:T_RPAREN
# | -:T_LPAREN T_LENEQ <CharLenParamValue> -:T_COMMA <Expr> -:T_RPAREN
# | -:T_LPAREN T_KINDEQ <Expr> -:T_RPAREN
# | -:T_LPAREN T_LENEQ <CharLenParamValue> -:T_RPAREN
# | -:T_LPAREN <CharLenParamValue> -:T_RPAREN
#
## R508 chain rule deleted
#<LengthSelector> ::=
# T_ASTERISK <CharLength>
#
## R509
#<CharLength> ::=
# | -:T_LPAREN <CharLenParamValue> -:T_RPAREN
# | T_ICON
#
## R510 <CharLenParamValue> was <TypeParamValue>
#<CharLenParamValue> ::=
# | <Expr>
# | T_ASTERISK
#JO--X
# R507, R508, R509, R510
<CharSelector> ::=
| -:T_ASTERISK (inline):<CharLength>
| -:T_LPAREN -:T_LENEQ (inline):<CharLenParamValue> -:T_COMMA -:T_KINDEQ kindExpr:<Expr> -:T_RPAREN
| -:T_LPAREN -:T_LENEQ (inline):<CharLenParamValue> -:T_COMMA kindExpr:<Expr> -:T_RPAREN
| -:T_LPAREN -:T_KINDEQ kindExpr:<Expr> -:T_RPAREN
| -:T_LPAREN -:T_LENEQ (inline):<CharLenParamValue> -:T_RPAREN
| -:T_LPAREN (inline):<CharLenParamValue> -:T_RPAREN
| tLparen2(omit):T_LPAREN tKindEq2(omit):T_KINDEQ kindExpr2:<Expr> tComma2(omit):T_COMMA -:T_LENEQ (inline):<CharLenParamValue> -:T_RPAREN # FIXME should not need different names
<CharLenParamValue> ::=
| lengthExpr:<Expr>
| isAssumedLength(bool):T_ASTERISK
| isColon(bool):T_COLON # F03 R204/R424
# R509
<CharLength> ::=
| -:T_LPAREN (inline):<CharLenParamValue> -:T_RPAREN
| constIntLength:T_ICON
| constNameLength:<Name>
# R511
<AccessSpec> ::=
| isPublic(bool):T_PUBLIC
| isPrivate(bool):T_PRIVATE
# F08 R509
<CoarraySpec> ::=
| <DeferredCoshapeSpecList>
| <ExplicitCoshapeSpec>
# F08 R510
(list):<DeferredCoshapeSpecList> ::=
| -:T_COLON
| <DeferredCoshapeSpecList> -:T_COMMA -:T_COLON
# F08 R511
<ExplicitCoshapeSpec> ::= (inline):<AssumedSizeSpec>
# R512
<IntentSpec> ::=
| isIntentIn(bool):T_IN
| isIntentOut(bool):T_OUT
| isIntentInOut(bool):T_INOUT
| isIntentInOut(bool):T_IN -:T_OUT
# R513 see 16
<ArraySpec> ::=
| <ExplicitShapeSpecList>
| <AssumedSizeSpec>
| <AssumedShapeSpecList>
| <DeferredShapeSpecList>
# JO -- Looks like <DeferredShapeSpecList> is in here since <LowerBound> is actually optional
(list):<AssumedShapeSpecList> ::=
| (inline):<LowerBound> -:T_COLON
| <DeferredShapeSpecList> -:T_COMMA (inline):<LowerBound> -:T_COLON
| <AssumedShapeSpecList> -:T_COMMA (inline):<AssumedShapeSpec>
# R514
(list):<ExplicitShapeSpecList> ::=
| <ExplicitShapeSpec>
| <ExplicitShapeSpecList> -:T_COMMA <ExplicitShapeSpec>
<ExplicitShapeSpec> ::=
| (inline):<LowerBound> -:T_COLON (inline):<UpperBound>
| (inline):<UpperBound>
# R515
<LowerBound> ::= Lb:<Expr>
# R516
<UpperBound> ::= Ub:<Expr>
# R517
<AssumedShapeSpec> ::=
| (inline):<LowerBound> -:T_COLON
| -:T_COLON
# R518
(list):<DeferredShapeSpecList> ::=
| (inline):<DeferredShapeSpec>
| <DeferredShapeSpecList> -:T_COMMA (inline):<DeferredShapeSpec>
<DeferredShapeSpec> ::= -:T_COLON
# R519
<AssumedSizeSpec> ::=
| -:T_ASTERISK
| (inline):<LowerBound> -:T_COLON -:T_ASTERISK
| <ExplicitShapeSpecList> -:T_COMMA -:T_ASTERISK
| <ExplicitShapeSpecList> -:T_COMMA (inline):<LowerBound> -:T_COLON -:T_ASTERISK
# R520
<IntentStmt> ::=
| (inline):<LblDef> -:T_INTENT -:T_LPAREN <IntentSpec> -:T_RPAREN variableList:<IntentParList> -:T_EOS
| (inline):<LblDef> -:T_INTENT -:T_LPAREN <IntentSpec> -:T_RPAREN -:T_COLON -:T_COLON variableList:<IntentParList> -:T_EOS
(list):<IntentParList> ::=
(inline):<IntentPar>
| <IntentParList> -:T_COMMA (inline):<IntentPar>
<IntentPar> ::=
(inline):<DummyArgName>
# R521
<OptionalStmt> ::=
| (inline):<LblDef> -:T_OPTIONAL variableList:<OptionalParList> -:T_EOS
| (inline):<LblDef> -:T_OPTIONAL -:T_COLON -:T_COLON variableList:<OptionalParList> -:T_EOS
(list):<OptionalParList> ::=
| (inline):<OptionalPar>
| <OptionalParList> -:T_COMMA (inline):<OptionalPar>
<OptionalPar> ::= (inline):<DummyArgName>
# R522
<AccessStmt> ::=
| (inline):<LblDef> <AccessSpec> -:T_COLON -:T_COLON <AccessIdList> -:T_EOS
| (inline):<LblDef> <AccessSpec> <AccessIdList> -:T_EOS
| (inline):<LblDef> <AccessSpec> -:T_EOS
# R523
(list):<AccessIdList> ::=
| <AccessId>
| <AccessIdList> -:T_COMMA <AccessId>
(superclass):<AccessId> ::=
| <GenericName>
| <GenericSpec>
# R524
<SaveStmt> ::=
| (inline):<LblDef> -:T_SAVE -:T_EOS
| (inline):<LblDef> -:T_SAVE variableList:<SavedEntityList> -:T_EOS
| (inline):<LblDef> -:T_SAVE -:T_COLON -:T_COLON variableList:<SavedEntityList> -:T_EOS
# R525
(list):<SavedEntityList> ::=
| <SavedEntity>
| <SavedEntityList> -:T_COMMA <SavedEntity>
<SavedEntity> ::=
| (inline):<VariableName>
| (inline):<SavedCommonBlock>
<SavedCommonBlock> ::= -:T_SLASH (inline):<CommonBlockName> -:T_SLASH
# R526
<DimensionStmt> ::=
| (inline):<LblDef> -:T_DIMENSION -:T_COLON -:T_COLON <ArrayDeclaratorList> -:T_EOS
| (inline):<LblDef> -:T_DIMENSION <ArrayDeclaratorList> -:T_EOS
(list):<ArrayDeclaratorList> ::=
| <ArrayDeclarator>
| <ArrayDeclaratorList> -:T_COMMA <ArrayDeclarator>
# JO -- <ArraySpec> since pulled up into common block
<ArrayDeclarator> ::= (inline):<VariableName> -:T_LPAREN <ArraySpec> -:T_RPAREN
# R527
<AllocatableStmt> ::=
| (inline):<LblDef> -:T_ALLOCATABLE -:T_COLON -:T_COLON <ArrayAllocationList> -:T_EOS
| (inline):<LblDef> -:T_ALLOCATABLE <ArrayAllocationList> -:T_EOS
(list):<ArrayAllocationList> ::=
| <ArrayAllocation>
| <ArrayAllocationList> -:T_COMMA <ArrayAllocation>
<ArrayAllocation> ::=
| (inline):<ArrayName>
| (inline):<ArrayName> -:T_LPAREN <DeferredShapeSpecList> -:T_RPAREN
# F03 R521
<AsynchronousStmt> ::=
| (inline):<LblDef> -:T_ASYNCHRONOUS -:T_COLON -:T_COLON <ObjectList> -:T_EOS
| (inline):<LblDef> -:T_ASYNCHRONOUS <ObjectList> -:T_EOS
(list):<ObjectList> ::=
| T_IDENT
| <ObjectList> -:T_COMMA T_IDENT
# F03 R522
<BindStmt> ::=
| (inline):<LblDef> <LanguageBindingSpec> -:T_COLON -:T_COLON <BindEntityList> -:T_EOS
| (inline):<LblDef> <LanguageBindingSpec> <BindEntityList> -:T_EOS
# F03 R523
(superclass):<BindEntity> ::=
| <VariableName>
| -:T_SLASH common-block-name:T_IDENT -:T_SLASH <= ASTCommonBlockBinding
(list):<BindEntityList> ::=
| <BindEntity>
| <BindEntityList> -:T_COMMA <BindEntity>
# R528 <ObjectName> renamed to <PointerName> to simplify Semantic Analysis
<PointerStmt> ::=
| (inline):<LblDef> -:T_POINTER -:T_COLON -:T_COLON <PointerStmtObjectList> -:T_EOS
| (inline):<LblDef> -:T_POINTER <PointerStmtObjectList> -:T_EOS
(list):<PointerStmtObjectList> ::=
| <PointerStmtObject>
| <PointerStmtObjectList> -:T_COMMA <PointerStmtObject>
<PointerStmtObject> ::=
| (inline):<PointerName>
| (inline):<PointerName> -:T_LPAREN <DeferredShapeSpecList> -:T_RPAREN
<PointerName> ::= pointerName:T_IDENT
# JO - Cray Pointers
<CrayPointerStmt> ::=
| (inline):<LblDef> -:T_POINTER <CrayPointerStmtObjectList> -:T_EOS
(list):<CrayPointerStmtObjectList> ::=
| <CrayPointerStmtObject>
| <CrayPointerStmtObjectList> -:T_COMMA <CrayPointerStmtObject>
<CrayPointerStmtObject> ::=
| -:T_LPAREN (inline):<PointerName> -:T_COMMA <TargetObject> -:T_RPAREN
# F08 R531
<CodimensionStmt> ::=
| (inline):<LblDef> -:T_CODIMENSION -:T_COLON -:T_COLON <CodimensionDeclList> -:T_EOS
| (inline):<LblDef> -:T_CODIMENSION <CodimensionDeclList> -:T_EOS
(list):<CodimensionDeclList> ::=
| <CodimensionDecl>
| <CodimensionDeclList> -:T_COMMA <CodimensionDecl>
# F08 R532
<CodimensionDecl> ::=
| <Name> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
# F08 R533
<ContiguousStmt> ::=
| (inline):<LblDef> -:T_CONTIGUOUS -:T_COLON -:T_COLON <ObjectNameList> -:T_EOS
| (inline):<LblDef> -:T_CONTIGUOUS <ObjectNameList> -:T_EOS
(list):<ObjectNameList> ::=
| (inline):<Name>
| <ObjectNameList> -:T_COMMA (inline):<Name>
# F03 R542
<ProtectedStmt> ::=
| (inline):<LblDef> -:T_PROTECTED -:T_COLON -:T_COLON entityNameList:<ObjectList> -:T_EOS
| (inline):<LblDef> -:T_PROTECTED entityNameList:<ObjectList> -:T_EOS
# R529 <ObjectName> renamed to <TargetName> to simplify Semantic Analysis
<TargetStmt> ::=
| (inline):<LblDef> -:T_TARGET -:T_COLON -:T_COLON <TargetObjectList> -:T_EOS
| (inline):<LblDef> -:T_TARGET <TargetObjectList> -:T_EOS
(list):<TargetObjectList> ::=
| <TargetObject>
| <TargetObjectList> -:T_COMMA <TargetObject>
<TargetObject> ::=
| (inline):<TargetName>
| (inline):<TargetName> -:T_LPAREN <ArraySpec> -:T_RPAREN
# F08 R557
| (inline):<TargetName> -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
| (inline):<TargetName> -:T_LPAREN <ArraySpec> -:T_RPAREN -:T_LBRACKET <CoarraySpec> -:T_RBRACKET
<TargetName> ::= targetName:T_IDENT
# F03 R547
<ValueStmt> ::=
| (inline):<LblDef> -:T_VALUE -:T_COLON -:T_COLON entityNameList:<ObjectList> -:T_EOS
| (inline):<LblDef> -:T_VALUE entityNameList:<ObjectList> -:T_EOS
# F03 R548
<VolatileStmt> ::=
| (inline):<LblDef> -:T_VOLATILE -:T_COLON -:T_COLON entityNameList:<ObjectList> -:T_EOS
| (inline):<LblDef> -:T_VOLATILE entityNameList:<ObjectList> -:T_EOS
# R530
<ParameterStmt> ::=
(inline):<LblDef> -:T_PARAMETER -:T_LPAREN <NamedConstantDefList> -:T_RPAREN -:T_EOS
# R531
(list):<NamedConstantDefList> ::=
| <NamedConstantDef>
| <NamedConstantDefList> -:T_COMMA <NamedConstantDef>
<NamedConstantDef> ::= (inline):<NamedConstant> -:T_EQUALS initializationExpr:<Expr>
# R532
# JO -- Added error production
<DataStmt> ::=
| (inline):<LblDef> -:T_DATA <Datalist> -:T_EOS
| (inline):<LblDef> -:T_DATA (error) T_EOS
(list):<Datalist> ::=
| <DataStmtSet>
| <Datalist> <DataStmtSet>
| <Datalist> -:T_COMMA <DataStmtSet>
# R533
<DataStmtSet> ::= <DataStmtObjectList> -:T_SLASH <DataStmtValueList> -:T_SLASH
# R534
(list):<DataStmtObjectList> ::=
| <DataStmtObject>
| <DataStmtObjectList> -:T_COMMA <DataStmtObject>
(superclass):<DataStmtObject> ::=
| <Variable>
| <DataImpliedDo>
# R535 <Expr> must be scalar-int-expr
<DataImpliedDo> ::=
| -:T_LPAREN <DataIDoObjectList> -:T_COMMA (inline):<ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_RPAREN
| -:T_LPAREN <DataIDoObjectList> -:T_COMMA (inline):<ImpliedDoVariable> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_COMMA step:<Expr> -:T_RPAREN
# R536 <StructureComponent> must be <ScalarStructureComponent>
(list):<DataIDoObjectList> ::=
| <DataIDoObject>
| <DataIDoObjectList> -:T_COMMA <DataIDoObject>
(superclass):<DataIDoObject> ::=
| <ArrayElement>
| <DataImpliedDo>
| <StructureComponent>
# R537 chain rule deleted
# R538
(list):<DataStmtValueList> ::=
| <DataStmtValue>
| <DataStmtValueList> -:T_COMMA <DataStmtValue>
<DataStmtValue> ::=
| (inline):<DataStmtConstant>
| hasConstIntKind(bool):T_ICON -:T_ASTERISK (inline):<DataStmtConstant>
| namedConstKind:<NamedConstantUse> -:T_ASTERISK (inline):<DataStmtConstant>
# R539 chain rule deleted
# R540 only a subset of <constant> is allowed
<DataStmtConstant> ::=
| <Constant>
| isNull(bool):T_NULL -:T_LPAREN -:T_RPAREN
# R541
<ImplicitStmt> ::=
| (inline):<LblDef> implicitToken:T_IMPLICIT <ImplicitSpecList> -:T_EOS
| (inline):<LblDef> implicitToken:T_IMPLICIT isImplicitNone(bool):T_NONE -:T_EOS
# R542
(list):<ImplicitSpecList> ::=
| <ImplicitSpec>
| <ImplicitSpecList> -:T_COMMA <ImplicitSpec>
<ImplicitSpec> ::= <TypeSpec> charRanges:T_xImpl
# R543 chain rule deleted
# R544
<NamelistStmt> ::=
(inline):<LblDef> T_NAMELIST <NamelistGroups> -:T_EOS
(list):<NamelistGroups> ::=
| -:T_SLASH (inline):<NamelistGroupName> -:T_SLASH namelistGroupObject(inline):<NamelistGroupObject>
| <NamelistGroups> -:T_SLASH (inline):<NamelistGroupName> -:T_SLASH namelistGroupObject(inline):<NamelistGroupObject>
| <NamelistGroups> -:T_COMMA -:T_SLASH (inline):<NamelistGroupName> -:T_SLASH namelistGroupObject(inline):<NamelistGroupObject>
| <NamelistGroups> -:T_COMMA namelistGroupObject(inline):<NamelistGroupObject>
# R545
<NamelistGroupObject> ::= (inline):<VariableName>
# R546
<EquivalenceStmt> ::=
(inline):<LblDef> -:T_EQUIVALENCE <EquivalenceSetList> -:T_EOS
# R547
(list):<EquivalenceSetList> ::=
| <EquivalenceSet>
| <EquivalenceSetList> -:T_COMMA <EquivalenceSet>
<EquivalenceSet> ::= -:T_LPAREN Initial(inline):<EquivalenceObject> -:T_COMMA equivalentObjects:<EquivalenceObjectList> -:T_RPAREN
# R548
(list):<EquivalenceObjectList> ::=
| (inline):<EquivalenceObject>
| <EquivalenceObjectList> -:T_COMMA (inline):<EquivalenceObject>
# JO -- Changed xVariable to <Variable>
<EquivalenceObject> ::= <Variable>
## R549
#<CommonStmt> ::=
# (inline):<LblDef> T_COMMON <Comlist> -:T_EOS
#
#(list):<Comlist> ::=
# | <CommonBlockObject>
# | <Comblock> <CommonBlockObject>
# | <Comlist> -:T_COMMA <CommonBlockObject>
# | <Comlist> <Comblock> <CommonBlockObject>
# | <Comlist> -:T_COMMA <Comblock> <CommonBlockObject>
#
#<Comblock> ::=
# | T_SLASH T_SLASH
# | T_SLASH <CommonBlockName> T_SLASH
##JO--X
## R549
#<CommonStmt> ::=
# (inline):<LblDef> -:T_COMMON <CommonBlockList> -:T_EOS
#(list):<CommonBlockList> ::=
# | <CommonBlock>
# | <CommonBlockList> <CommonBlock>
# | <CommonBlockList> -:T_COMMA <CommonBlock>
#<CommonBlock> ::=
# | <CommonBlockObjectList>
# | -:T_SLASH -:T_SLASH <CommonBlockObjectList>
# | -:T_SLASH name:<CommonBlockName> -:T_SLASH <CommonBlockObjectList>
#(list):<CommonBlockObjectList> ::=
# | <CommonBlockObject>
# | <CommonBlockObjectList> <CommonBlockObject>
#
## R550
#<CommonBlockObject> ::=
# | (inline):<VariableName>
# | (inline):<ArrayDeclarator>
#JO--XX
# R549
<CommonStmt> ::=
(inline):<LblDef> -:T_COMMON <CommonBlockList> -:T_EOS
(list):<CommonBlockList> ::=
| <CommonBlock>
| <CommonBlockList> <CommonBlock>
<CommonBlock> ::=
| <CommonBlockObjectList>
| -:T_SLASH -:T_SLASH <CommonBlockObjectList>
| -:T_SLASH name:<CommonBlockName> -:T_SLASH <CommonBlockObjectList>
(list):<CommonBlockObjectList> ::=
| <CommonBlockObject>
| <CommonBlockObjectList> <CommonBlockObject>
# R550
<CommonBlockObject> ::=
| (inline):<VariableName>
| (inline):<ArrayDeclarator>
| (inline):<VariableName> -:T_COMMA
| (inline):<ArrayDeclarator> -:T_COMMA
#######################################################################################################################
# Section 6 Rules
#######################################################################################################################
# R601 The various forms of variables have to be recognized semantically;
# JO -- Added substring of constant strings
<Variable> ::=
| <DataRef>
| <DataRef> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN
| <DataRef> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <SubstringRange>
| (inline):<SubstrConst>
# F08 <ImageSelector>
| <DataRef> <ImageSelector>
| <DataRef> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <ImageSelector>
| <DataRef> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <ImageSelector> <SubstringRange>
# JO -- Added substring of constant strings
<SubstrConst> ::=
stringConst:T_SCON <SubstringRange>
<VariableName> ::= variableName:T_IDENT
<ScalarVariable> ::=
| (inline):<VariableName>
| (inline):<ArrayElement>
# R603-R608 chain rules deleted
# R609 see 601
# R610 see 601
# R611
<SubstringRange> ::= -:T_LPAREN <SubscriptTriplet> -:T_RPAREN
# R612
(list):<DataRef> ::=
| (inline):<Name>
| <DataRef> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| <DataRef> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
# F08 <ImageSelector>
| (inline):<Name> <ImageSelector>
| <DataRef> <ImageSelector> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| <DataRef> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
(list):<SFDataRef> ::=
| (inline):<Name> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| (inline):<Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN
| <SFDataRef> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| <SFDataRef> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
# F08 <ImageSelector>
| (inline):<Name> <ImageSelector> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| (inline):<Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector>
| <SFDataRef> <ImageSelector> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
| <SFDataRef> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> hasDerivedTypeComponentName(bool):T_PERCENT ComponentName:<Name>
# R613 chain rule deleted;
# R614
(list):<StructureComponent> ::=
| <VariableName> <FieldSelector>
| <StructureComponent> <FieldSelector>
<FieldSelector> ::=
| -:T_LPAREN <SectionSubscriptList> -:T_RPAREN hasDerivedTypeComponentRef(bool):T_PERCENT Component(inline):<Name>
| hasDerivedTypeComponentRef(bool):T_PERCENT Component(inline):<Name>
# F08 <ImageSelector>
| -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <ImageSelector> hasDerivedTypeComponentRef(bool):T_PERCENT Component(inline):<Name>
| <ImageSelector> hasDerivedTypeComponentRef(bool):T_PERCENT Component(inline):<Name>
# R615
<ArrayElement> ::=
| (inline):<VariableName> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN
| <StructureComponent> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN
# F08 <ImageSelector>
| (inline):<VariableName> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <ImageSelector>
| <StructureComponent> -:T_LPAREN <SectionSubscriptList> -:T_RPAREN <ImageSelector>
# R616 Recognized semantically?
# R617 Recognized semantically
<Subscript> ::= SubscriptExpr:<Expr>
# R618 Recognized semantically?
(list):<SectionSubscriptList> ::=
| <SectionSubscript>
| <SectionSubscriptList> -:T_COMMA <SectionSubscript>
<SectionSubscript> ::=
| <Expr>
| <SubscriptTriplet>
# R619
<SubscriptTriplet> ::=
| -:T_COLON
| -:T_COLON ub:<Expr>
| lb:<Expr> -:T_COLON
| lb:<Expr> -:T_COLON ub:<Expr>
| lb:<Expr> -:T_COLON ub:<Expr> -:T_COLON step:<Expr>
| lb:<Expr> -:T_COLON -:T_COLON step:<Expr>
| -:T_COLON ub:<Expr> -:T_COLON step:<Expr>
| -:T_COLON -:T_COLON step:<Expr>
# R620 chain rule deleted
# R621 recognized semantically?
# R622
<AllocateStmt> ::=
| (inline):<LblDef> -:T_ALLOCATE -:T_LPAREN <AllocationList> -:T_COMMA -:T_STATEQ statusVariable:<Variable> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_ALLOCATE -:T_LPAREN <AllocationList> -:T_RPAREN -:T_EOS
# F03 R623 -- TODO: This leads to some tricky conflicts (probably need to duplicate <TypeSpecNoPrefix>) -- fix later
# | (inline):<LblDef> -:T_ALLOCATE -:T_LPAREN <TypeSpecNoPrefix> -:T_COLON -:T_COLON <AllocationList> -:T_COMMA -:T_STATEQ statusVariable:<Variable> -:T_RPAREN -:T_EOS
# | (inline):<LblDef> -:T_ALLOCATE -:T_LPAREN <TypeSpecNoPrefix> -:T_COLON -:T_COLON <AllocationList> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_ALLOCATE -:T_LPAREN (error) T_EOS
# R623 chain rule deleted
# R624
(list):<AllocationList> ::=
| <Allocation>
| <AllocationList> -:T_COMMA <Allocation>
<Allocation> ::=
| <AllocateObject>
| <AllocateObject> (inline):<AllocatedShape>
<AllocatedShape> ::= hasAllocatedShape(bool):T_LPAREN <SectionSubscriptList> -:T_RPAREN
# F08 <AllocateCoarraySpec>
| hasAllocatedShape(bool):T_LPAREN <SectionSubscriptList> -:T_RPAREN -:T_LBRACKET <AllocateCoarraySpec> -:T_RBRACKET
| -:T_LBRACKET <AllocateCoarraySpec> -:T_RBRACKET
# Need to use <SectionSubscriptList> here to solve an LALR(1) conflict with the
# <FieldSelector> in R625. (Can't tell which we have until the character
# following the right paren, but we must reduce WITHIN the parens.)
# R625
(list):<AllocateObjectList> ::=
| <AllocateObject>
| <AllocateObjectList> -:T_COMMA <AllocateObject>
(list):<AllocateObject> ::=
| <VariableName>
| <AllocateObject> <FieldSelector>
# F08 R636
<AllocateCoarraySpec> ::=
| <SectionSubscriptList> -:T_COMMA lb:<Expr> -:T_COLON isAsterisk(bool):T_ASTERISK
| <SectionSubscriptList> -:T_COMMA isAsterisk(bool):T_ASTERISK
| lb:<Expr> -:T_COLON isAsterisk(bool):T_ASTERISK
| isAsterisk(bool):T_ASTERISK
# R626
# Omitted to solve LALR(1) conflict. see R624
#
# <AllocateShapeSpec>: <Expr> | <Expr> T_COLON <Expr> ;
# R627 chain rule deleted
# R628 chain rule deleted
# F08 R624
<ImageSelector> ::= -:T_LBRACKET <SectionSubscriptList> -:T_RBRACKET
# R629
<NullifyStmt> ::=
(inline):<LblDef> -:T_NULLIFY -:T_LPAREN <PointerObjectList> -:T_RPAREN -:T_EOS
(list):<PointerObjectList> ::=
| <PointerObject>
| <PointerObjectList> -:T_COMMA <PointerObject>
# R630
<PointerObject> ::=
| <Name>
| <PointerField>
(list):<PointerField> ::=
| <Name> -:T_LPAREN <SFExprList> -:T_RPAREN hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
| <Name> -:T_LPAREN <SFDummyArgNameList> -:T_RPAREN hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
| <Name> hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
| <PointerField> <FieldSelector>
# F08 <ImageSelector>
| <Name> -:T_LPAREN <SFExprList> -:T_RPAREN <ImageSelector> hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
| <Name> -:T_LPAREN <SFDummyArgNameList> -:T_RPAREN <ImageSelector> hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
| <Name> <ImageSelector> hasDerivedTypeComponentRef(bool):T_PERCENT componentName:<Name>
# R631
<DeallocateStmt> ::=
| (inline):<LblDef> -:T_DEALLOCATE -:T_LPAREN <AllocateObjectList> -:T_COMMA -:T_STATEQ statusVariable:<Variable> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_DEALLOCATE -:T_LPAREN <AllocateObjectList> -:T_RPAREN -:T_EOS
#######################################################################################################################
# Section 7 Rules, continued (Primary)
#######################################################################################################################
# It is not clear to me whether some of the subcategories of Primary
# are complete
# R701
# JO -- Added substring of constant strings
IExpr(superclass):<Primary> ::=
| logicalConst:<LogicalConstant>
| stringConst:T_SCON <= ASTStringConstNode
| <UnsignedArithmeticConstant>
| <ArrayConstructor>
| <Name> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
# F03 this line for type-bound procedures
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <SubstringRange> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> -:T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| (inline):<FunctionReference> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| -:T_LPAREN <Expr> -:T_RPAREN <= ASTNestedExprNode
| (inline):<SubstrConst> <= ASTStringConstNode
# F08 <ImageSelector>
| <Name> <ImageSelector> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| <Name> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
| <Name> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <ImageSelector> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <SubstringRange> <ImageSelector> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <= ASTVarOrFnRefNode
| (inline):<FunctionReference> <ImageSelector> hiddenPercent2(omit):T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN substringRange2:<SubstringRange> <= ASTVarOrFnRefNode
<CPrimary> ::=
| (inline):<COperand>
| -:T_LPAREN nestedExpression:<CExpr> -:T_RPAREN
<COperand> ::=
| stringConst:T_SCON
| <Name>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| (inline):<FunctionReference>
# F08 <ImageSelector>
| <Name> <ImageSelector>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector>
| <Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
# Dirk Rossow: Added <SubstringRange> to allow: write(text(1)(2:20),*) 'hello'
<UFPrimary> ::=
| intConst:T_ICON
| stringConst:T_SCON
| (inline):<FunctionReference>
| <Name>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <SubstringRange>
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange>
| -:T_LPAREN nestedExpression:<UFExpr> -:T_RPAREN
# F08 <ImageSelector>
| <Name> <ImageSelector>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> <SubstringRange>
| <Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef>
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN
| <Name> -:T_LPAREN primarySectionSubscriptList:<SectionSubscriptList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange>
# R702 chain rule deleted
# R703
IExpr(superclass):<Level1Expr> ::=
| <Primary>
| operator:<DefinedUnaryOp> operand:<Primary> <= ASTUnaryExprNode
# R704 defined in source form
# R705
IExpr(superclass):<MultOperand> ::=
| <Level1Expr>
| lhsExpr:<Level1Expr> operator:<PowerOp> rhsExpr:<MultOperand> <= ASTBinaryExprNode
<UFFactor> ::=
| <UFPrimary>
| lhsPrimary:<UFPrimary> <PowerOp> rhsExpr:<UFFactor>
# R706
IExpr(superclass):<AddOperand> ::=
| <MultOperand>
| lhsExpr:<AddOperand> operator:<MultOp> rhsExpr:<MultOperand> <= ASTBinaryExprNode
<UFTerm> ::=
| <UFFactor>
| lhsExpr:<UFTerm> <MultOp> rhsExpr:<UFFactor>
| lhsExpr:<UFTerm> <ConcatOp> rhsPrimary:<UFPrimary>
# R707
IExpr(superclass):<Level2Expr> ::=
| <AddOperand>
| sign:<Sign> operand:<AddOperand> <= ASTUnaryExprNode
| lhsExpr:<Level2Expr> operator:<AddOp> rhsExpr:<AddOperand> <= ASTBinaryExprNode
# We need to distinguish unary operators
<UFExpr> ::=
| <UFTerm>
| rhs2:<Sign> rhsExpr:<UFTerm>
| lhsExpr:<UFExpr> <AddOp> rhsExpr:<UFTerm>
# R708-710 defined in source form
# R711
IExpr(superclass):<Level3Expr> ::=
| <Level2Expr>
| lhsExpr:<Level3Expr> operator:<ConcatOp> rhsExpr:<Level2Expr> <= ASTBinaryExprNode
<CExpr> ::=
| rhsPrimary:<CPrimary>
| lhsExpr:<CExpr> <ConcatOp> rhsPrimary:<CPrimary>
# R712 defined in source form
# R713
IExpr(superclass):<Level4Expr> ::=
| <Level3Expr>
| lhsExpr:<Level3Expr> operator:<RelOp> rhsExpr:<Level3Expr> <= ASTBinaryExprNode
# R714 defined in source form
# R715
IExpr(superclass):<AndOperand> ::=
| <Level4Expr>
| operator:<NotOp> operand:<Level4Expr> <= ASTUnaryExprNode
# R716
IExpr(superclass):<OrOperand> ::=
| <AndOperand>
| lhsExpr:<OrOperand> operator:<AndOp> rhsExpr:<AndOperand> <= ASTBinaryExprNode
# R717
IExpr(superclass):<EquivOperand> ::=
| <OrOperand>
| lhsExpr:<EquivOperand> operator:<OrOp> rhsExpr:<OrOperand> <= ASTBinaryExprNode
# R718
IExpr(superclass):<Level5Expr> ::=
| <EquivOperand>
| lhsExpr:<Level5Expr> operator:<EquivOp> rhsExpr:<EquivOperand> <= ASTBinaryExprNode
# R719-722 defined in source form
# R723
IExpr(superclass):<Expr> ::=
| <Level5Expr>
| lhsExpr:<Expr> operator:<DefinedBinaryOp> rhsExpr:<Level5Expr> <= ASTBinaryExprNode
(list):<SFExprList> ::=
| lb:<SFExpr> -:T_COLON ub:<Expr> -:T_COLON step:<Expr>
| lb:<SFExpr> -:T_COLON -:T_COLON step:<Expr>
| -:T_COLON ub:<Expr> -:T_COLON step:<Expr>
| -:T_COLON -:T_COLON step:<Expr>
#(list):<SFExprList> ::=
| -:T_COLON
| -:T_COLON ub:<Expr>
| lb:<SFExpr>
| lb:<SFExpr> -:T_COLON
| lb:<SFExpr> -:T_COLON ub:<Expr>
| <SFExprList> -:T_COMMA <SectionSubscript>
| <SFDummyArgNameList> -:T_COMMA -:T_COLON
| <SFDummyArgNameList> -:T_COMMA -:T_COLON ub:<Expr>
| <SFDummyArgNameList> -:T_COMMA lb:<SFExpr>
| <SFDummyArgNameList> -:T_COMMA lb:<SFExpr> -:T_COLON
| <SFDummyArgNameList> -:T_COMMA lb:<SFExpr> -:T_COLON ub:<Expr>
# R724 defined in source form
# R725-R734 chain rule deleted
# R735 - JO - Macro substituted; added error production
ASTAssignmentStmtNode:<AssignmentStmt> ::=
| (inline):<LblDef> lhsVariable:<Name> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> (error) T_EOS
# F08 <ImageSelector>
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <ImageSelector> <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN -:T_EQUALS rhs:<Expr> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> lparen2(omit):T_LPAREN componentSectionSubscriptList:<SectionSubscriptList> rparen2(omit):T_RPAREN <SubstringRange> -:T_EQUALS rhs:<Expr> -:T_EOS
<SFExpr> ::=
| <SFTerm>
| rhs:<Sign> rhsExpr:<AddOperand>
| lhsExpr:<SFExpr> <AddOp> rhsExpr:<AddOperand>
<SFTerm> ::=
| <SFFactor>
| lhsExpr:<SFTerm> <MultOp> rhsExpr:<MultOperand>
<SFFactor> ::=
| rhsPrimary:<SFPrimary>
| lhsPrimary:<SFPrimary> <PowerOp> rhsExpr:<MultOperand>
<SFPrimary> ::=
| <ArrayConstructor>
| intConst:T_ICON
| <SFVarName>
| <SFDataRef>
| <FunctionReference>
| -:T_LPAREN <Expr> -:T_RPAREN
#<AssignmentStmt> ::=
# (inline):<LblDef> <Name> T_PERCENT <DataRef>
# ( -:T_LPAREN <SectionSubscriptList> -:T_RPAREN ( <SubstringRange> )? )?
# T_EQUALS <Expr> -:T_EOS |
# (inline):<LblDef> <Name> -:T_LPAREN <SFExprList> -:T_RPAREN T_PERCENT <DataRef>
# ( -:T_LPAREN <SectionSubscriptList> -:T_RPAREN ( <SubstringRange> )? )?
# T_EQUALS <Expr> -:T_EOS |
# (inline):<LblDef> <Name> -:T_LPAREN <SFDummyArgNameList> -:T_RPAREN T_PERCENT <DataRef>
# ( -:T_LPAREN <SectionSubscriptList> -:T_RPAREN ( <SubstringRange> )? )? T_EQUALS
# <Expr> -:T_EOS ;
# R736 -- subsumes F03 R735
ASTAssignmentStmtNode:<PointerAssignmentStmt> ::=
| (inline):<LblDef> lhsVariable:<Name> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
# F08 <ImageSelector>
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsExprList:<SFExprList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
| (inline):<LblDef> lhsVariable:<Name> -:T_LPAREN lhsNameList:<SFDummyArgNameList> -:T_RPAREN <ImageSelector> -:T_PERCENT derivedTypeComponentRef:<DataRef> isPointerAssignment(bool):T_EQGREATERTHAN <Target> -:T_EOS
# R737
# JO - Added NULL() target
<Target> ::=
| <Expr>
| isNull(bool):T_NULL -:T_LPAREN -:T_RPAREN
# R738
<WhereStmt> ::=
(inline):<LblDef> -:T_WHERE -:T_LPAREN <MaskExpr> -:T_RPAREN <AssignmentStmt>
# R739 parallels if ... then ...elseif... else ... endif construct
<WhereConstruct> ::=
<WhereConstructStmt> (inline):<WhereRange>
<WhereRange> ::=
| <EndWhereStmt>
| <WhereBodyConstructBlock> <EndWhereStmt>
| <MaskedElseWhereConstruct>
| <WhereBodyConstructBlock> <MaskedElseWhereConstruct>
| <ElseWhereConstruct>
| <WhereBodyConstructBlock> <ElseWhereConstruct>
<MaskedElseWhereConstruct> ::=
<MaskedElseWhereStmt> (inline):<WhereRange>
<ElseWhereConstruct> ::=
<ElseWhereStmt> (inline):<ElseWherePart>
<ElseWherePart> ::=
| <EndWhereStmt>
| <WhereBodyConstructBlock> <EndWhereStmt>
(list):<WhereBodyConstructBlock> ::=
| <WhereBodyConstruct>
| <WhereBodyConstructBlock> <WhereBodyConstruct>
# R740
<WhereConstructStmt> ::=
| (inline):<LblDef> WhereConstruct(inline):<Name> -:T_COLON -:T_WHERE -:T_LPAREN <MaskExpr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_WHERE -:T_LPAREN <MaskExpr> -:T_RPAREN -:T_EOS
# R741
(superclass):<WhereBodyConstruct> ::=
| <AssignmentStmt>
| <WhereStmt>
| <WhereConstruct>
# R742 chain rule deleted
# R743
<MaskExpr> ::= maskExpr:<Expr>
# R744
<MaskedElseWhereStmt> ::=
| (inline):<LblDef> -:T_ELSEWHERE -:T_LPAREN (inline):<MaskExpr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_ELSEWHERE -:T_LPAREN (inline):<MaskExpr> -:T_RPAREN (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_WHERE -:T_LPAREN (inline):<MaskExpr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_WHERE -:T_LPAREN (inline):<MaskExpr> -:T_RPAREN (inline):<EndName> -:T_EOS
# R745
<ElseWhereStmt> ::=
| (inline):<LblDef> -:T_ELSEWHERE -:T_EOS
| (inline):<LblDef> -:T_ELSEWHERE (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_WHERE -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_WHERE (inline):<EndName> -:T_EOS
# R746
<EndWhereStmt> ::=
| (inline):<LblDef> -:T_ENDWHERE -:T_EOS
| (inline):<LblDef> -:T_ENDWHERE (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_WHERE -:T_EOS
| (inline):<LblDef> -:T_END -:T_WHERE (inline):<EndName> -:T_EOS
# R747
<ForallConstruct> ::=
| <ForallConstructStmt> <EndForallStmt>
| <ForallConstructStmt> <ForallBody> <EndForallStmt>
(list):<ForallBody> ::=
| <ForallBodyConstruct>
| <ForallBody> <ForallBodyConstruct>
# R748
# JO -- Added error productions
<ForallConstructStmt> ::=
| (inline):<LblDef> -:T_FORALL (inline):<ForallHeader> -:T_EOS
| (inline):<LblDef> (inline):<Name> -:T_COLON -:T_FORALL (inline):<ForallHeader> -:T_EOS
| (inline):<LblDef> -:T_FORALL (error) T_EOS
| (inline):<LblDef> (inline):<Name> -:T_COLON -:T_FORALL (error) T_EOS
# R749
<ForallHeader> ::=
| -:T_LPAREN <ForallTripletSpecList> -:T_RPAREN
| -:T_LPAREN <ForallTripletSpecList> -:T_COMMA <ScalarMaskExpr> -:T_RPAREN
<ScalarMaskExpr> ::= (inline):<MaskExpr>
# R750
(list):<ForallTripletSpecList> ::=
| <Name> -:T_EQUALS Lb:<Subscript> -:T_COLON Ub:<Subscript>
| <Name> -:T_EQUALS Lb:<Subscript> -:T_COLON Ub:<Subscript> -:T_COLON stepExpr:<Expr>
| <ForallTripletSpecList> -:T_COMMA <Name> -:T_EQUALS Lb:<Subscript> -:T_COLON Ub:<Subscript>
| <ForallTripletSpecList> -:T_COMMA <Name> -:T_EQUALS Lb:<Subscript> -:T_COLON Ub:<Subscript> -:T_COLON stepExpr:<Expr>
# R751
(superclass):<ForallBodyConstruct> ::=
| <AssignmentStmt>
| <PointerAssignmentStmt>
| <WhereStmt>
| <WhereConstruct>
| <ForallConstruct>
| <ForallStmt>
# R752 chain rule eliminated
# R753
<EndForallStmt> ::=
| (inline):<LblDef> -:T_END -:T_FORALL -:T_EOS
| (inline):<LblDef> -:T_END -:T_FORALL (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ENDFORALL -:T_EOS
| (inline):<LblDef> -:T_ENDFORALL (inline):<EndName> -:T_EOS
# R754
<ForallStmt> ::=
(inline):<LblDef> -:T_FORALL (inline):<ForallHeader> assignment:<AssignmentStmt>
| (inline):<LblDef> -:T_FORALL (inline):<ForallHeader> assignment:<PointerAssignmentStmt>
#######################################################################################################################
# Section 8 Rules
#######################################################################################################################
# R801 see the note on R818
# R802
<IfConstruct> ::=
<IfThenStmt> (inline):<ThenPart>
<ThenPart> ::=
| <EndIfStmt>
| <ConditionalBody> <EndIfStmt>
| <ElseIfConstruct>
| <ConditionalBody> <ElseIfConstruct>
| <ElseConstruct>
| <ConditionalBody> <ElseConstruct>
<ElseIfConstruct> ::=
<ElseIfStmt> (inline):<ThenPart>
<ElseConstruct> ::=
<ElseStmt> (inline):<ElsePart>
<ElsePart> ::=
| <EndIfStmt>
| <ConditionalBody> <EndIfStmt>
(list):<ConditionalBody> ::=
| <ExecutionPartConstruct>
| <ConditionalBody> <ExecutionPartConstruct>
##JO
#<IfConstruct> ::=
#| <IfPart> <EndIfStmt>
#| <IfPart> <ElseIfParts> <EndIfStmt>
#| <IfPart> <ElsePart> <EndIfStmt>
#| <IfPart> <ElseIfParts> <ElsePart> <EndIfStmt>
#
#<IfPart> ::=
#| <IfThenStmt>
#| <IfThenStmt> ifBody:<ConditionalBody>
#
#(list):<ElseIfParts> ::=
# <ElseIfPart>
#| <ElseIfParts> <ElseIfPart>
#
#<ElseIfPart> ::=
#| <ElseIfStmt>
#| <ElseIfStmt> body:<ConditionalBody>
#
#<ElsePart> ::=
#| <ElseStmt>
#| <ElseStmt> elseBody:<ConditionalBody>
##JO--X
#<IfConstruct> ::=
# | <IfThenStmt> thenBody:<ConditionalBody> <ElseIfParts> <ElseStmt> elseBody:<ConditionalBody> <EndIfStmt>
# | <IfThenStmt> thenBody:<ConditionalBody> <ElseStmt> elseBody:<ConditionalBody> <EndIfStmt>
# | <IfThenStmt> thenBody:<ConditionalBody> <ElseIfParts> <EndIfStmt>
# | <IfThenStmt> thenBody:<ConditionalBody> <EndIfStmt>
#(list):<ElseIfParts> ::=
# | <ElseIfConstruct>
# | <ElseIfParts> <ElseIfConstruct>
#<ElseIfConstruct> ::=
# | <ElseIfStmt> elseIfBody:<ConditionalBody>
#(list):<ConditionalBody> ::=
# | (empty)
# | <ConditionalBody> <ExecutionPartConstruct>
# R803
# JO -- Added error production
<IfThenStmt> ::=
| (inline):<LblDef> -:T_IF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN -:T_EOS
| (inline):<LblDef> IfConstruct(inline):<Name> -:T_COLON -:T_IF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN -:T_EOS
| (inline):<LblDef> -:T_IF <IfThenError> -:T_EOS
| (inline):<LblDef> IfConstruct(inline):<Name> -:T_COLON -:T_IF <IfThenError> -:T_EOS
<IfThenError> ::= (error) T_THEN
# R804
# JO -- Added error production
<ElseIfStmt> ::=
| (inline):<LblDef> -:T_ELSEIF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN -:T_EOS
| (inline):<LblDef> -:T_ELSEIF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_IF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN -:T_EOS
| (inline):<LblDef> -:T_ELSE -:T_IF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN -:T_THEN (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ELSEIF (error) T_EOS
| (inline):<LblDef> -:T_ELSE -:T_IF (error) T_EOS
# R805
# JO -- Added error production
<ElseStmt> ::=
| (inline):<LblDef> -:T_ELSE -:T_EOS
| (inline):<LblDef> -:T_ELSE (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ELSE (error) T_EOS
# R806
<EndIfStmt> ::=
| (inline):<LblDef> -:T_ENDIF -:T_EOS
| (inline):<LblDef> -:T_ENDIF (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_IF -:T_EOS
| (inline):<LblDef> -:T_END -:T_IF (inline):<EndName> -:T_EOS
# R807
# JO -- Added error production
<IfStmt> ::=
| (inline):<LblDef> T_IF -:T_LPAREN guardingExpression:<Expr> -:T_RPAREN <ActionStmt>
| (inline):<LblDef> T_IF (error) T_EOS
# F08 R807
<BlockConstruct> ::=
<BlockStmt> <EndBlockStmt>
| <BlockStmt> <Body> <EndBlockStmt>
# F08 R808
<BlockStmt> ::=
| (inline):<LblDef> -:T_BLOCK -:T_EOS
| (inline):<LblDef> (inline):<Name> -:T_COLON -:T_BLOCK -:T_EOS
# F08 R809
<EndBlockStmt> ::=
| (inline):<LblDef> -:T_ENDBLOCK -:T_EOS
| (inline):<LblDef> -:T_ENDBLOCK (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_BLOCK -:T_EOS
| (inline):<LblDef> -:T_END -:T_BLOCK (inline):<EndName> -:T_EOS
# F08 R810
<CriticalConstruct> ::=
<CriticalStmt> <EndCriticalStmt>
| <CriticalStmt> <Body> <EndCriticalStmt>
# F08 R811
<CriticalStmt> ::=
| (inline):<LblDef> -:T_CRITICAL -:T_EOS
| (inline):<LblDef> (inline):<Name> -:T_COLON -:T_CRITICAL -:T_EOS
# F08 R812
<EndCriticalStmt> ::=
| (inline):<LblDef> -:T_ENDCRITICAL -:T_EOS
| (inline):<LblDef> -:T_ENDCRITICAL (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_CRITICAL -:T_EOS
| (inline):<LblDef> -:T_END -:T_CRITICAL (inline):<EndName> -:T_EOS
# R808
<CaseConstruct> ::=
<SelectCaseStmt> (inline):<SelectCaseRange>
<SelectCaseRange> ::=
| <SelectCaseBody> <EndSelectStmt>
| <EndSelectStmt>
(list):<SelectCaseBody> ::=
| <CaseBodyConstruct> # JO--X Was | <CaseStmt>
| <SelectCaseBody> <CaseBodyConstruct>
(superclass):<CaseBodyConstruct> ::=
| <CaseStmt>
| <ExecutionPartConstruct>
# R809 chain rule eliminated
# JO -- Added error production
<SelectCaseStmt> ::=
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECTCASE -:T_LPAREN selectionExpression:<Expr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_SELECTCASE -:T_LPAREN selectionExpression:<Expr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECT -:T_CASE -:T_LPAREN selectionExpression:<Expr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_SELECT -:T_CASE -:T_LPAREN selectionExpression:<Expr> -:T_RPAREN -:T_EOS
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECTCASE (error) T_EOS
| (inline):<LblDef> -:T_SELECTCASE (error) T_EOS
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECT -:T_CASE (error) T_EOS
| (inline):<LblDef> -:T_SELECT -:T_CASE (error) T_EOS
# R810
# JO -- Added error production
<CaseStmt> ::=
| (inline):<LblDef> -:T_CASE (inline):<CaseSelector> -:T_EOS
| (inline):<LblDef> -:T_CASE (inline):<CaseSelector> <Name> -:T_EOS
| (inline):<LblDef> -:T_CASE (error) T_EOS
# R811
<EndSelectStmt> ::=
| (inline):<LblDef> -:T_ENDSELECT -:T_EOS
| (inline):<LblDef> -:T_ENDSELECT (inline):<EndName> -:T_EOS
# F03 changed
# | (inline):<LblDef> -:T_END -:T_SELECT -:T_EOS
# | (inline):<LblDef> -:T_END -:T_SELECT (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_ENDBEFORESELECT -:T_SELECT -:T_EOS
| (inline):<LblDef> -:T_ENDBEFORESELECT -:T_SELECT (inline):<EndName> -:T_EOS
# R812 chain rules deleted
# R813
<CaseSelector> ::=
| -:T_LPAREN caseValueRangeListSelector:<CaseValueRangeList> -:T_RPAREN
| hasDefaultSelector(bool):T_DEFAULT
(list):<CaseValueRangeList> ::=
| <CaseValueRange>
| <CaseValueRangeList> -:T_COMMA <CaseValueRange>
# R814
<CaseValueRange> ::=
| lb:<Expr>
| lb:<Expr> -:T_COLON
| -:T_COLON ub:<Expr>
| lb:<Expr> -:T_COLON ub:<Expr>
# R815 chain rules deleted
# F03 R816
<AssociateConstruct> ::=
| <AssociateStmt> <AssociateBody> <EndAssociateStmt>
| <AssociateStmt> <EndAssociateStmt>
# F03 R817
<AssociateStmt> ::=
| (inline):<LblDef> (inline):<Name> -:T_COLON -:T_ASSOCIATE -:T_LPAREN <AssociationList> -:T_RPAREN -:T_EOS
| -:T_ASSOCIATE -:T_LPAREN <AssociationList> -:T_RPAREN -:T_EOS
(list):<AssociationList> ::=
| <Association>
| <AssociationList> -:T_COMMA <Association>
# F03 R818
<Association> ::= associateName:T_IDENT -:T_EQGREATERTHAN <Selector>
# F03 R819
(superclass):<Selector> ::= <Expr> #| <Variable>
# F03 copy of "block"
(list):<AssociateBody> ::=
| <ExecutionPartConstruct>
| <AssociateBody> <ExecutionPartConstruct>
# F03 R820
<EndAssociateStmt> ::=
| (inline):<LblDef> -:T_END -:T_ASSOCIATE -:T_EOS
| (inline):<LblDef> -:T_END -:T_ASSOCIATE associate-construct-name:T_IDENT -:T_EOS
# F03 R821
<SelectTypeConstruct> ::=
| <SelectTypeStmt> <SelectTypeBody> <EndSelectTypeStmt>
| <SelectTypeStmt> <EndSelectTypeStmt>
(list):<SelectTypeBody> ::=
| <TypeGuardStmt> <TypeGuardBlock>
| <SelectTypeBody> <TypeGuardStmt> <TypeGuardBlock>
# F03 copy of "block"
(list):<TypeGuardBlock> ::=
| (empty)
| <TypeGuardBlock> <ExecutionPartConstruct>
# F03 R822 -- modeled after SelectCaseStmt to prevent conflicts
<SelectTypeStmt> ::= # omitted numeric labels to prevent conflict
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECT -:T_TYPE -:T_LPAREN associate-name:T_IDENT -:T_EQGREATERTHAN <Selector> -:T_RPAREN -:T_EOS
| (inline):<LblDef> SelectConstruct(inline):<Name> -:T_COLON -:T_SELECT -:T_TYPE -:T_LPAREN <Selector> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_SELECT -:T_TYPE -:T_LPAREN associate-name:T_IDENT -:T_EQGREATERTHAN <Selector> -:T_RPAREN -:T_EOS
| (inline):<LblDef> -:T_SELECT -:T_TYPE -:T_LPAREN <Selector> -:T_RPAREN -:T_EOS
# F03 R823
<TypeGuardStmt> ::=
| is-type(bool):T_TYPE -:T_IS -:T_LPAREN <TypeSpecNoPrefix> -:T_RPAREN -:T_EOS
| is-type(bool):T_TYPE -:T_IS -:T_LPAREN <TypeSpecNoPrefix> -:T_RPAREN select-construct-name:T_IDENT -:T_EOS
| is-class(bool):T_CLASS -:T_IS -:T_LPAREN <TypeSpecNoPrefix> -:T_RPAREN -:T_EOS
| is-class(bool):T_CLASS -:T_IS -:T_LPAREN <TypeSpecNoPrefix> -:T_RPAREN select-construct-name:T_IDENT -:T_EOS
| is-default(bool):T_CLASS -:T_DEFAULT -:T_EOS
| is-default(bool):T_CLASS -:T_DEFAULT select-construct-name:T_IDENT -:T_EOS
# F03 R824
# -- T_ENDBEFORESELECT instead of T_END since only one token of lookahead
# -- No (inline):<LblDef> to resolve S/R conflict
#<EndSelectTypeStmt> ::=
# | (inline):<LblDef> -:T_END -:T_SELECT -:T_EOS
# | (inline):<LblDef> -:T_END -:T_SELECT select-construct-name:T_IDENT -:T_EOS
<EndSelectTypeStmt> ::=
| -:T_ENDSELECT -:T_EOS
| -:T_ENDSELECT select-construct-name:T_IDENT -:T_EOS
| -:T_ENDBEFORESELECT -:T_SELECT -:T_EOS
| -:T_ENDBEFORESELECT -:T_SELECT select-construct-name:T_IDENT -:T_EOS
# R816
<DoConstruct> ::= (inline):<BlockDoConstruct>
# R817
# Block DO constructs cannot be recognized syntactically because there is
# no requirement that there be an end do statement;
#
# <BlockDoConstruct>:
# <DoStmt> <Block> <EndDoStmt> |
# <DoStmt> <Block> ;
<BlockDoConstruct> ::= <LabelDoStmt>
# R818
<LabelDoStmt> ::=
| (inline):<LblDef> -:T_DO <LblRef> (inline):<CommaLoopControl> -:T_EOS
| (inline):<LblDef> -:T_DO <LblRef> -:T_EOS
| (inline):<LblDef> -:T_DO (inline):<CommaLoopControl> -:T_EOS
| (inline):<LblDef> -:T_DO -:T_EOS
| (inline):<LblDef> DoConstruct(inline):<Name> -:T_COLON -:T_DO <LblRef> (inline):<CommaLoopControl> -:T_EOS
| (inline):<LblDef> DoConstruct(inline):<Name> -:T_COLON -:T_DO <LblRef> -:T_EOS
| (inline):<LblDef> DoConstruct(inline):<Name> -:T_COLON -:T_DO (inline):<CommaLoopControl> -:T_EOS
| (inline):<LblDef> DoConstruct(inline):<Name> -:T_COLON -:T_DO -:T_EOS
# R819 chain rule deleted
# R820 chain rule deleted
# R821 see 40
# JO -- <LoopControl> since pulled up into <LabelDoStmt>
<CommaLoopControl> ::=
| -:T_COMMA <LoopControl>
| <LoopControl>
<LoopControl> ::=
| loop(inline):<VariableName> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr>
| loop(inline):<VariableName> -:T_EQUALS lb:<Expr> -:T_COMMA ub:<Expr> -:T_COMMA step:<Expr>
| -:T_WHILE -:T_LPAREN whileExpr:<Expr> -:T_RPAREN
# R822 chain rule deleted
# R823 chain rule deleted
# R824 see note on R817
# R825
<EndDoStmt> ::=
| (inline):<LblDef> -:T_ENDDO -:T_EOS
| (inline):<LblDef> -:T_ENDDO (inline):<EndName> -:T_EOS
| (inline):<LblDef> -:T_END -:T_DO -:T_EOS
| (inline):<LblDef> -:T_END -:T_DO (inline):<EndName> -:T_EOS
# R826-R833 enforced semantically
# R834
<CycleStmt> ::=
| (inline):<LblDef> -:T_CYCLE -:T_EOS
| (inline):<LblDef> -:T_CYCLE (inline):<Name> -:T_EOS
# R835