A-LPG / LPG2

The LALR parser generator (LPG) is a tool for developing scanners and parsers. Supports multi-language . Input is specified by BNF rules. LPG supports backtracking (to resolve ambiguity), automatic AST generation and grammar inheritance.
Eclipse Public License 2.0
5 stars 4 forks source link

Grammar railroad diagram #3

Closed mingodad closed 2 years ago

mingodad commented 2 years ago

Based on the code from void Grammar::DisplayInput(void) I built so far this initial EBNF grammar (after some small manual changes) that can be used on https://www.bottlecaps.de/rr/ui to get a railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram).

I think that it's a useful option to have on LPG2.

Copy and paste the EBNF shown bellow on https://www.bottlecaps.de/rr/ui in the TAB Edit Grammar then switch to the TAB View Diagram.

//EBNF to be viewed with https://www.bottlecaps.de/rr/ui

JikesPG_INPUT ::= Grammar
 Grammar ::= //$Empty
 Grammar ::= Grammar include_segment END_KEY_opt
 Grammar ::= Grammar notice_segment END_KEY_opt
 Grammar ::= Grammar define_segment END_KEY_opt
 Grammar ::= Grammar terminals_segment END_KEY_opt
 Grammar ::= Grammar export_segment END_KEY_opt
 Grammar ::= Grammar import_segment END_KEY_opt
 Grammar ::= Grammar softkeywords_segment END_KEY_opt
 Grammar ::= Grammar eof_segment END_KEY_opt
 Grammar ::= Grammar eol_segment END_KEY_opt
 Grammar ::= Grammar error_segment END_KEY_opt
 Grammar ::= Grammar recover_segment END_KEY_opt
 Grammar ::= Grammar identifier_segment END_KEY_opt
 Grammar ::= Grammar start_segment END_KEY_opt
 Grammar ::= Grammar alias_segment END_KEY_opt
 Grammar ::= Grammar names_segment END_KEY_opt
 Grammar ::= Grammar headers_segment END_KEY_opt
 Grammar ::= Grammar ast_segment END_KEY_opt
 Grammar ::= Grammar globals_segment END_KEY_opt
 Grammar ::= Grammar trailers_segment END_KEY_opt
 Grammar ::= Grammar rules_segment END_KEY_opt
 Grammar ::= Grammar types_segment END_KEY_opt
 Grammar ::= Grammar dps_segment END_KEY_opt
 include_segment ::= 'INCLUDE_KEY'
 include_segment ::= 'INCLUDE_KEY' 'SYMBOL'
 notice_segment ::= 'NOTICE_KEY'
 notice_segment ::= notice_segment action_segment
 define_segment ::= 'DEFINE_KEY'
 define_segment ::= define_segment macro_name_symbol macro_segment
 macro_name_symbol ::= 'MACRO_NAME'
 macro_name_symbol ::= 'SYMBOL'
 macro_segment ::= 'BLOCK'
 terminals_segment ::= 'TERMINALS_KEY'
 terminals_segment ::= terminals_segment terminal_symbol
 terminals_segment ::= terminals_segment terminal_symbol produces name
 export_segment ::= 'EXPORT_KEY'
 export_segment ::= export_segment terminal_symbol
 import_segment ::= 'IMPORT_KEY'
 import_segment ::= 'IMPORT_KEY' 'SYMBOL' drop_command_list
 drop_command ::= drop_symbols
 drop_command ::= drop_rules
 drop_command ::= 'DROPACTIONS_KEY'
 drop_symbols ::= 'DROPSYMBOLS_KEY'
 drop_symbols ::= drop_symbols 'SYMBOL'
 drop_rules ::= 'DROPRULES_KEY'
 drop_rules ::= drop_rules drop_rule
 drop_rule ::= 'SYMBOL' produces rhs
 drop_rule ::= 'SYMBOL' 'MACRO_NAME' produces rhs
 drop_rule ::= drop_rule '|' rhs
 drop_command_list ::= //$Empty
 drop_command_list ::= drop_command_list drop_command
 softkeywords_segment ::= 'SOFTKEYWORDS_KEY'
 softkeywords_segment ::= softkeywords_segment terminal_symbol
 softkeywords_segment ::= softkeywords_segment terminal_symbol produces name
 error_segment ::= 'ERROR_KEY'
 error_segment ::= 'ERROR_KEY' terminal_symbol
 recover_segment ::= 'RECOVER_KEY'
 recover_segment ::= recover_segment terminal_symbol
 identifier_segment ::= 'IDENTIFIER_KEY'
 identifier_segment ::= 'IDENTIFIER_KEY' terminal_symbol
 eol_segment ::= 'EOL_KEY'
 eol_segment ::= 'EOL_KEY' terminal_symbol
 eof_segment ::= 'EOF_KEY'
 eof_segment ::= 'EOF_KEY' terminal_symbol
 terminal_symbol ::= 'SYMBOL'
 terminal_symbol ::= 'MACRO_NAME'
 alias_segment ::= 'ALIAS_KEY'
 alias_segment ::= alias_segment 'ERROR_KEY' produces alias_rhs
 alias_segment ::= alias_segment 'EOL_KEY' produces alias_rhs
 alias_segment ::= alias_segment 'EOF_KEY' produces alias_rhs
 alias_segment ::= alias_segment 'IDENTIFIER_KEY' produces alias_rhs
 alias_segment ::= alias_segment 'SYMBOL' produces alias_rhs
 alias_segment ::= alias_segment alias_lhs_macro_name produces alias_rhs
 alias_lhs_macro_name ::= 'MACRO_NAME'
 alias_rhs ::= 'SYMBOL'
 alias_rhs ::= 'MACRO_NAME'
 alias_rhs ::= 'ERROR_KEY'
 alias_rhs ::= 'EOL_KEY'
 alias_rhs ::= 'EOF_KEY'
 alias_rhs ::= 'EMPTY_KEY'
 alias_rhs ::= 'IDENTIFIER_KEY'
 start_segment ::= 'START_KEY'
 start_segment ::= start_segment start_symbol
 headers_segment ::= 'HEADERS_KEY'
 headers_segment ::= headers_segment headers_action_segment_list
 headers_action_segment_list ::= action_segment
 headers_action_segment_list ::= headers_action_segment_list action_segment
 ast_segment ::= 'AST_KEY'
 ast_segment ::= ast_segment action_segment
 globals_segment ::= 'GLOBALS_KEY'
 globals_segment ::= globals_segment action_segment
 trailers_segment ::= 'TRAILERS_KEY'
 trailers_segment ::= trailers_segment action_segment
 start_symbol ::= 'SYMBOL'
 start_symbol ::= 'MACRO_NAME'
 rules_segment ::= 'RULES_KEY' action_segment_list
 rules_segment ::= rules_segment rules
 rules ::= 'SYMBOL' produces rhs
 rules ::= 'SYMBOL' 'MACRO_NAME' produces rhs
 rules ::= 'SYMBOL' 'MACRO_NAME' 'MACRO_NAME' produces rhs
 rules ::= rules '|' rhs
 produces ::= '::='
 produces ::= '::=?'
 produces ::= '->'
 produces ::= '->?'
 rhs ::= //$Empty
 rhs ::= rhs 'SYMBOL'
 rhs ::= rhs 'SYMBOL' 'MACRO_NAME'
 rhs ::= rhs 'EMPTY_KEY'
 rhs ::= rhs rhs_action_segment_list
 rhs_action_segment_list ::= action_segment
 rhs_action_segment_list ::= rhs_action_segment_list action_segment
 action_segment ::= 'BLOCK'
 types_segment ::= 'TYPES_KEY'
 types_segment ::= types_segment type_declarationlist
 type_declarationlist ::= type_declarations
                        | type_declarations 'BLOCK'
 type_declarations ::= 'SYMBOL' produces 'SYMBOL'
                     | type_declarations '|' 'SYMBOL'
 dps_segment ::= 'DISJOINTPREDECESSORSETS_KEY'
 dps_segment ::= dps_segment 'SYMBOL' 'SYMBOL'
 names_segment ::= 'NAMES_KEY'
 names_segment ::= names_segment name produces name
 name ::= 'SYMBOL'
 name ::= 'MACRO_NAME'
 name ::= 'EMPTY_KEY'
 name ::= 'ERROR_KEY'
 name ::= 'EOL_KEY'
 name ::= 'IDENTIFIER_KEY'
 END_KEY_opt ::= //$Empty
 END_KEY_opt ::= 'END_KEY'
 action_segment_list ::= //$Empty
 action_segment_list ::= action_segment_list action_segment

Initial code to generate EBNF understood by https://www.bottlecaps.de/rr/ui:

void Grammar::GenEBNF(void)
{
    //
    // First, flush any data left in the report buffer.
    //
    FILE *f = option -> syslis;

    //
    //    Print the Rules
    //
    fprintf(f, "\n\n//EBNF to be viewed with https://www.bottlecaps.de/rr/ui\n\n");
    {
        int alternate_space = 0;
        char64_t buf;

        //
        // Print the user specified rules.
        //
        for (int rule_index = start_symbol.Length(); rule_index <= num_rules; rule_index++)
        {
            int source_index = rules[rule_index].source_index;
            if (rules[rule_index].IsAlternateProduction())
            {
                for (int i = 0; i < alternate_space; i++)
                    putc(' ', f);
                putc(option -> or_marker, f);
            }
            else
            {
                const char *lhs_name = lex_stream -> NameString(parser.rules[source_index].lhs_index);
                alternate_space = strlen(lhs_name) + (rules[rule_index].IsArrowProduction() ? 3 : 4);
                DisplaySymbol(lhs_name);
                int classname_index = parser.rules[source_index].classname_index,
                    array_element_type_index = parser.rules[source_index].array_element_type_index;
                if (classname_index != 0 && array_element_type_index == 0)
                     fprintf(f, "%s", lex_stream -> NameString(classname_index));
                else if (classname_index == 0 && array_element_type_index != 0)
                     fprintf(f, "%c%c%s", option -> macro_prefix,
                                                         option ->macro_prefix,
                                                         lex_stream -> NameString(classname_index));
                else if (classname_index != 0 && array_element_type_index != 0)
                     fprintf(f, "%s%c%s", lex_stream -> NameString(classname_index),
                                                         option ->macro_prefix,
                                                         lex_stream -> NameString(array_element_type_index));
                else assert (classname_index == 0 && array_element_type_index == 0);

                if (rules[rule_index].IsArrowProduction())
                     fprintf(f, " ::= /*->*/ ");
                else fprintf(f, " ::=");
            }

            for (int j = lex_stream -> Next(parser.rules[source_index].separator_index);
                     j < parser.rules[source_index].end_rhs_index;
                     j = lex_stream -> Next(j))
            {
                if (lex_stream -> Kind(j) == TK_SYMBOL) {
                     VariableSymbol *rhs_symbol = GetSymbol(j);
                     int image = (rhs_symbol ? AssignSymbolIndex(rhs_symbol) : 0);
                     if (image && IsTerminal(image))
                         fprintf(f, " '%s'", lex_stream -> NameString(j));
                     else
                        DisplaySymbol(lex_stream -> NameString(j));
                }
                else if (lex_stream -> Kind(j) == TK_MACRO_NAME)
                     fprintf(f, " %s", lex_stream -> NameString(j));
                else if (lex_stream -> Kind(j) == TK_EMPTY_KEY)
                     fprintf(f, " //%c%s", option -> escape, "Empty");
            }

            putc('\n', f);
        }

        putc('\n', f); // leave a gap before listing the remaining rules.
    }

    return;
}
mingodad commented 2 years ago

And here is the EBNF for java.g:

Goal ::= '++' CompilationUnit
 Goal ::= '--' MethodBody
 Goal ::= '>>' StaticInitializer
 Goal ::= '>>' Initializer
 Goal ::= '>>>' Header1 Modifiersopt
 Goal ::= '!' Header2 Modifiersopt
 Goal ::= '*' BlockStatements
 Goal ::= '*' CatchHeader
 Goal ::= '&&' FieldDeclaration
 Goal ::= '||' ImportDeclaration
 Goal ::= '?' PackageDeclaration
 Goal ::= '+' TypeDeclaration
 Goal ::= '/' GenericMethodDeclaration
 Goal ::= '&' ClassBodyDeclarations
 Goal ::= '%' Expression
 Goal ::= '%' ArrayInitializer
 Goal ::= '~' BlockStatementsopt
 Goal ::= '{' BlockStatementopt
 Goal ::= '||' MemberValue
 Goal ::= '?' AnnotationTypeMemberDeclaration
 Goal ::= '->' ParenthesizedLambdaParameterList
 Goal ::= '(' ParenthesizedCastNameAndBounds
 Goal ::= '<' ReferenceExpressionTypeArgumentsAndTrunk
 Goal ::= '@' TypeAnnotations
 Goal ::= '->' YieldStatement
 Goal ::= '->' SwitchLabelCaseLhs
 Goal ::= 'RestrictedIdentifiersealed' Modifiersopt
 Goal ::= 'RestrictedIdentifierpermits' PermittedSubclasses
 Literal ::= /*->*/  'IntegerLiteral'
 Literal ::= /*->*/  'LongLiteral'
 Literal ::= /*->*/  'FloatingPointLiteral'
 Literal ::= /*->*/  'DoubleLiteral'
 Literal ::= /*->*/  'CharacterLiteral'
 Literal ::= /*->*/  'StringLiteral'
 Literal ::= /*->*/  'TextBlock'
 Literal ::= /*->*/  'null'
 Literal ::= /*->*/  BooleanLiteral
 BooleanLiteral ::= /*->*/  'true'
 BooleanLiteral ::= /*->*/  'false'
 Type ::= PrimitiveType
 Type ::= /*->*/  ReferenceType
 PrimitiveType ::= /*->*/  TypeAnnotationsopt NumericType
 NumericType ::= /*->*/  IntegralType
 NumericType ::= /*->*/  FloatingPointType
 PrimitiveType ::= /*->*/  TypeAnnotationsopt 'boolean'
 PrimitiveType ::= /*->*/  TypeAnnotationsopt 'void'
 IntegralType ::= /*->*/  'byte'
 IntegralType ::= /*->*/  'short'
 IntegralType ::= /*->*/  'int'
 IntegralType ::= /*->*/  'long'
 IntegralType ::= /*->*/  'char'
 FloatingPointType ::= /*->*/  'float'
 FloatingPointType ::= /*->*/  'double'
 ReferenceType ::= ClassOrInterfaceType
 ReferenceType ::= /*->*/  ArrayType
 ClassOrInterfaceType ::= /*->*/  ClassOrInterface
 ClassOrInterfaceType ::= /*->*/  GenericType
 ClassOrInterface ::= Name
 ClassOrInterface ::= GenericType '.' Name
 GenericType ::= ClassOrInterface TypeArguments
 GenericType ::= ClassOrInterface '<' '>'
 ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name
 ArrayType ::= PrimitiveType Dims
 ArrayType ::= Name Dims
 ArrayType ::= ArrayTypeWithTypeArgumentsName Dims
 ArrayType ::= GenericType Dims
 ClassType ::= /*->*/  ClassOrInterfaceType
 Name ::= SimpleName
 Name ::= /*->*/  TypeAnnotations SimpleName
 Name ::= /*->*/  QualifiedName
 SimpleName ::= /*->*/  'Identifier'
 UnannotatableName ::= /*->*/  SimpleName
 UnannotatableName ::= UnannotatableName '.' SimpleName
 QualifiedName ::= Name '.' SimpleName
 QualifiedName ::= Name '.' TypeAnnotations SimpleName
 TypeAnnotationsopt ::= //$Empty
 TypeAnnotationsopt ::= /*->*/  TypeAnnotations
 TypeAnnotations ::= TypeAnnotations0
 TypeAnnotations0 ::= /*->*/  TypeAnnotation
 TypeAnnotations0 ::= TypeAnnotations0 TypeAnnotation
 TypeAnnotation ::= NormalTypeAnnotation
 TypeAnnotation ::= MarkerTypeAnnotation
 TypeAnnotation ::= SingleMemberTypeAnnotation
 TypeAnnotationName ::= '@308' UnannotatableName
 NormalTypeAnnotation ::= TypeAnnotationName '(' MemberValuePairsopt ')'
 MarkerTypeAnnotation ::= TypeAnnotationName
 SingleMemberTypeAnnotation ::= TypeAnnotationName '(' SingleMemberAnnotationMemberValue ')'
 RejectTypeAnnotations ::= //$Empty
 PushZeroTypeAnnotations ::= //$Empty
 VariableDeclaratorIdOrThis ::= 'this'
 VariableDeclaratorIdOrThis ::= UnannotatableName '.' 'this'
 VariableDeclaratorIdOrThis ::= VariableDeclaratorId
 CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit
 InternalCompilationUnit ::= PackageDeclaration
 InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports
 InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations
 InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
 InternalCompilationUnit ::= ImportDeclarations ReduceImports
 InternalCompilationUnit ::= TypeDeclarations
 InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
 InternalCompilationUnit ::= //$Empty
 InternalCompilationUnit ::= ImportDeclarations ReduceImports ModuleDeclaration
 InternalCompilationUnit ::= ModuleDeclaration
 ModuleDeclaration ::= ModuleHeader ModuleBody
 ModuleHeader ::= Modifiersopt ModuleModifieropt 'module' UnannotatableName
 ModuleModifieropt ::= //$Empty
 ModuleModifieropt ::= ModuleModifier
 ModuleModifier ::= /*->*/  'open'
 ModuleBody ::= '{' ModuleStatementsOpt '}'
 ModuleStatementsOpt ::= //$Empty
 ModuleStatementsOpt ::= /*->*/  ModuleStatements
 ModuleStatements ::= ModuleStatement
 ModuleStatements ::= ModuleStatements ModuleStatement
 ModuleStatement ::= RequiresStatement
 ModuleStatement ::= ExportsStatement
 ModuleStatement ::= OpensStatement
 ModuleStatement ::= UsesStatement
 ModuleStatement ::= ProvidesStatement
 RequiresStatement ::= SingleRequiresModuleName ';'
 SingleRequiresModuleName ::= 'requires' RequiresModifiersopt UnannotatableName
 RequiresModifiersopt ::= RequiresModifiers
 RequiresModifiersopt ::= //$Empty
 RequiresModifiers ::= /*->*/  RequiresModifier
 RequiresModifiers ::= RequiresModifiers RequiresModifier
 RequiresModifier ::= /*->*/  'transitive'
 RequiresModifier ::= /*->*/  'static'
 ExportsStatement ::= ExportsHeader TargetModuleListopt ';'
 ExportsHeader ::= 'exports' SinglePkgName
 TargetModuleListopt ::= //$Empty
 TargetModuleListopt ::= 'to' TargetModuleNameList
 TargetModuleName ::= UnannotatableName
 TargetModuleNameList ::= /*->*/  TargetModuleName
 TargetModuleNameList ::= TargetModuleNameList ',' TargetModuleName
 SinglePkgName ::= UnannotatableName
 OpensStatement ::= OpensHeader TargetModuleListopt ';'
 OpensHeader ::= 'opens' SinglePkgName
 UsesStatement ::= UsesHeader ';'
 UsesHeader ::= 'uses' Name
 ProvidesStatement ::= ProvidesInterface WithClause ';'
 ProvidesInterface ::= 'provides' Name
 ServiceImplName ::= Name
 ServiceImplNameList ::= /*->*/  ServiceImplName
 ServiceImplNameList ::= ServiceImplNameList ',' ServiceImplName
 WithClause ::= 'with' ServiceImplNameList
 ReduceImports ::= //$Empty
 EnterCompilationUnit ::= //$Empty
 Header ::= /*->*/  ImportDeclaration
 Header ::= /*->*/  PackageDeclaration
 Header ::= /*->*/  ClassHeader
 Header ::= /*->*/  InterfaceHeader
 Header ::= /*->*/  EnumHeader
 Header ::= /*->*/  RecordHeaderPart
 Header ::= /*->*/  AnnotationTypeDeclarationHeader
 Header ::= /*->*/  StaticInitializer
 Header ::= /*->*/  RecoveryMethodHeader
 Header ::= /*->*/  FieldDeclaration
 Header ::= /*->*/  AllocationHeader
 Header ::= /*->*/  ArrayCreationHeader
 Header ::= /*->*/  ModuleHeader
 Header ::= /*->*/  RequiresStatement
 Header ::= /*->*/  ExportsStatement
 Header ::= /*->*/  UsesStatement
 Header ::= /*->*/  ProvidesStatement
 Header ::= /*->*/  OpensStatement
 Header1 ::= /*->*/  Header
 Header1 ::= /*->*/  ConstructorHeader
 Header2 ::= /*->*/  Header
 Header2 ::= /*->*/  EnumConstantHeader
 CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{'
 ImportDeclarations ::= /*->*/  ImportDeclaration
 ImportDeclarations ::= ImportDeclarations ImportDeclaration
 TypeDeclarations ::= /*->*/  TypeDeclaration
 TypeDeclarations ::= TypeDeclarations TypeDeclaration
 PackageDeclaration ::= PackageDeclarationName ';'
 PackageDeclarationName ::= Modifiers 'package' PushRealModifiers Name RejectTypeAnnotations
 PackageDeclarationName ::= PackageComment 'package' Name RejectTypeAnnotations
 PackageComment ::= //$Empty
 ImportDeclaration ::= /*->*/  SingleTypeImportDeclaration
 ImportDeclaration ::= /*->*/  TypeImportOnDemandDeclaration
 ImportDeclaration ::= /*->*/  SingleStaticImportDeclaration
 ImportDeclaration ::= /*->*/  StaticImportOnDemandDeclaration
 SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
 SingleTypeImportDeclarationName ::= 'import' Name RejectTypeAnnotations
 TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName ';'
 TypeImportOnDemandDeclarationName ::= 'import' Name '.' RejectTypeAnnotations '*'
 TypeDeclaration ::= /*->*/  ClassDeclaration
 TypeDeclaration ::= /*->*/  InterfaceDeclaration
 TypeDeclaration ::= ';'
 TypeDeclaration ::= /*->*/  EnumDeclaration
 TypeDeclaration ::= /*->*/  AnnotationTypeDeclaration
 TypeDeclaration ::= /*->*/  RecordDeclaration
 Modifiers ::= /*->*/  Modifier
 Modifiers ::= Modifiers Modifier
 Modifier ::= /*->*/  'public'
 Modifier ::= /*->*/  'protected'
 Modifier ::= /*->*/  'private'
 Modifier ::= /*->*/  'static'
 Modifier ::= /*->*/  'abstract'
 Modifier ::= /*->*/  'final'
 Modifier ::= /*->*/  'native'
 Modifier ::= /*->*/  'non-sealed'
 Modifier ::= /*->*/  'RestrictedIdentifiersealed'
 Modifier ::= /*->*/  'synchronized'
 Modifier ::= /*->*/  'transient'
 Modifier ::= /*->*/  'volatile'
 Modifier ::= /*->*/  'strictfp'
 Modifier ::= Annotation
 ClassDeclaration ::= ClassHeader ClassBody
 ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt ClassHeaderPermittedSubclassesopt
 ClassHeaderName ::= ClassHeaderName1 TypeParameters
 ClassHeaderName ::= /*->*/  ClassHeaderName1
 ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
 ClassHeaderExtends ::= 'extends' ClassType
 ClassHeaderImplements ::= 'implements' InterfaceTypeList
 InterfaceTypeList ::= /*->*/  InterfaceType
 InterfaceTypeList ::= InterfaceTypeList ',' InterfaceType
 InterfaceType ::= ClassOrInterfaceType
 ClassBody ::= '{' ClassBodyDeclarationsopt '}'
 ClassBodyDeclarations ::= ClassBodyDeclaration
 ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
 ClassBodyDeclaration ::= /*->*/  ClassMemberDeclaration
 ClassBodyDeclaration ::= /*->*/  StaticInitializer
 ClassBodyDeclaration ::= /*->*/  ConstructorDeclaration
 ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block
 Diet ::= //$Empty
 Initializer ::= Diet NestedMethod CreateInitializer Block
 CreateInitializer ::= //$Empty
 ClassMemberDeclaration ::= /*->*/  FieldDeclaration
 ClassMemberDeclaration ::= /*->*/  MethodDeclaration
 ClassMemberDeclaration ::= /*->*/  ClassDeclaration
 ClassMemberDeclaration ::= /*->*/  InterfaceDeclaration
 ClassMemberDeclaration ::= /*->*/  EnumDeclaration
 ClassMemberDeclaration ::= /*->*/  AnnotationTypeDeclaration
 ClassMemberDeclaration ::= /*->*/  RecordDeclaration
 ClassMemberDeclaration ::= ';'
 GenericMethodDeclaration ::= /*->*/  MethodDeclaration
 GenericMethodDeclaration ::= /*->*/  ConstructorDeclaration
 FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
 VariableDeclarators ::= /*->*/  VariableDeclarator
 VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
 VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
 VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
 EnterVariable ::= //$Empty
 ExitVariableWithInitialization ::= //$Empty
 ExitVariableWithoutInitialization ::= //$Empty
 ForceNoDiet ::= //$Empty
 RestoreDiet ::= //$Empty
 VariableDeclaratorId ::= 'Identifier' Dimsopt
 VariableInitializer ::= /*->*/  Expression
 VariableInitializer ::= /*->*/  ArrayInitializer
 MethodDeclaration ::= /*->*/  AbstractMethodDeclaration
 MethodDeclaration ::= MethodHeader MethodBody
 MethodDeclaration ::= DefaultMethodHeader MethodBody
 AbstractMethodDeclaration ::= MethodHeader ';'
 MethodHeader ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClauseopt
 DefaultMethodHeader ::= DefaultMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClauseopt
 MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
 MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
 DefaultMethodHeaderName ::= ModifiersWithDefault TypeParameters Type 'Identifier' '('
 DefaultMethodHeaderName ::= ModifiersWithDefault Type 'Identifier' '('
 ModifiersWithDefault ::= Modifiersopt 'default' Modifiersopt
 MethodHeaderRightParen ::= ')'
 MethodHeaderExtendedDims ::= Dimsopt
 MethodHeaderThrowsClause ::= 'throws' ClassTypeList
 ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt
 ConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier' '('
 ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
 FormalParameterList ::= /*->*/  FormalParameter
 FormalParameterList ::= FormalParameterList ',' FormalParameter
 FormalParameter ::= Modifiersopt Type VariableDeclaratorIdOrThis
 FormalParameter ::= Modifiersopt Type PushZeroTypeAnnotations '...' VariableDeclaratorIdOrThis
 FormalParameter ::= Modifiersopt Type '@308...' TypeAnnotations '...' VariableDeclaratorIdOrThis
 CatchFormalParameter ::= Modifiersopt CatchType VariableDeclaratorId
 CatchType ::= UnionType
 UnionType ::= Type
 UnionType ::= UnionType '|' Type
 ClassTypeList ::= /*->*/  ClassTypeElt
 ClassTypeList ::= ClassTypeList ',' ClassTypeElt
 ClassTypeElt ::= ClassType
 MethodBody ::= NestedMethod '{' BlockStatementsopt '}'
 NestedMethod ::= //$Empty
 StaticInitializer ::= StaticOnly Block
 StaticOnly ::= 'static'
 ConstructorDeclaration ::= ConstructorHeader MethodBody
 ConstructorDeclaration ::= ConstructorHeader ';'
 ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Name '.' 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Name '.' 'this' '(' ArgumentListopt ')' ';'
 ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
 InterfaceDeclaration ::= InterfaceHeader InterfaceBody
 InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt InterfaceHeaderPermittedSubClassesAndSubInterfacesopt
 InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters
 InterfaceHeaderName ::= /*->*/  InterfaceHeaderName1
 InterfaceHeaderName1 ::= Modifiersopt 'interface' 'Identifier'
 InterfaceHeaderExtends ::= 'extends' InterfaceTypeList
 InterfaceBody ::= '{' InterfaceMemberDeclarationsopt '}'
 InterfaceMemberDeclarations ::= /*->*/  InterfaceMemberDeclaration
 InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
 InterfaceMemberDeclaration ::= ';'
 InterfaceMemberDeclaration ::= /*->*/  ConstantDeclaration
 InterfaceMemberDeclaration ::= DefaultMethodHeader MethodBody
 InterfaceMemberDeclaration ::= MethodHeader MethodBody
 InterfaceMemberDeclaration ::= DefaultMethodHeader ';'
 InvalidConstructorDeclaration ::= ConstructorHeader MethodBody
 InvalidConstructorDeclaration ::= ConstructorHeader ';'
 InvalidInitializer ::= /*->*/  StaticInitializer
 InvalidInitializer ::= /*->*/  Initializer
 InterfaceMemberDeclaration ::= /*->*/  AbstractMethodDeclaration
 InterfaceMemberDeclaration ::= /*->*/  InvalidConstructorDeclaration
 InterfaceMemberDeclaration ::= /*->*/  InvalidInitializer
 InterfaceMemberDeclaration ::= /*->*/  ClassDeclaration
 InterfaceMemberDeclaration ::= /*->*/  InterfaceDeclaration
 InterfaceMemberDeclaration ::= /*->*/  EnumDeclaration
 InterfaceMemberDeclaration ::= /*->*/  AnnotationTypeDeclaration
 InterfaceMemberDeclaration ::= /*->*/  RecordDeclaration
 RecordDeclaration ::= RecordHeaderPart RecordBody
 RecordHeaderPart ::= RecordHeaderName RecordHeader ClassHeaderImplementsopt
 RecordHeaderName ::= RecordHeaderName1 TypeParameters
 RecordHeaderName ::= /*->*/  RecordHeaderName1
 RecordHeaderName1 ::= Modifiersopt 'RestrictedIdentifierrecord' 'Identifier'
 RecordComponentHeaderRightParen ::= ')'
 RecordHeader ::= '(' RecordComponentsopt RecordComponentHeaderRightParen
 RecordComponentsopt ::= //$Empty
 RecordComponentsopt ::= /*->*/  RecordComponents
 RecordComponents ::= /*->*/  RecordComponent
 RecordComponents ::= RecordComponents ',' RecordComponent
 RecordComponent ::= /*->*/  VariableArityRecordComponent
 RecordComponent ::= Modifiersopt Type VariableDeclaratorId
 VariableArityRecordComponent ::= Modifiersopt Type PushZeroTypeAnnotations '...' VariableDeclaratorId
 VariableArityRecordComponent ::= Modifiersopt Type '@308...' TypeAnnotations '...' VariableDeclaratorId
 RecordBody ::= '{' RecordBodyDeclarationopt '}'
 RecordBodyDeclarationopt ::= //$Empty
 RecordBodyDeclarationopt ::= /*->*/  RecordBodyDeclarations
 RecordBodyDeclarations ::= RecordBodyDeclaration
 RecordBodyDeclarations ::= RecordBodyDeclarations RecordBodyDeclaration
 RecordBodyDeclaration ::= ClassBodyDeclaration
 RecordBodyDeclaration ::= CompactConstructorDeclaration
 CompactConstructorDeclaration ::= CompactConstructorHeader MethodBody
 CompactConstructorHeader ::= CompactConstructorHeaderName MethodHeaderThrowsClauseopt
 CompactConstructorHeaderName ::= Modifiersopt 'Identifier'
 CompactConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier'
 InstanceofExpression ::= /*->*/  RelationalExpression
 InstanceofExpression ::= InstanceofExpression InstanceofRHS
 InstanceofRHS ::= /*->*/  InstanceofClassic
 InstanceofRHS ::= /*->*/  InstanceofPattern
 InstanceofClassic ::= 'instanceof' Modifiersopt Type
 InstanceofPattern ::= InstanceofClassic 'Identifier'
 ConstantDeclaration ::= /*->*/  FieldDeclaration
 PushLeftBrace ::= //$Empty
 ArrayInitializer ::= '{' PushLeftBrace opt_comma '}'
 ArrayInitializer ::= '{' PushLeftBrace VariableInitializers '}'
 ArrayInitializer ::= '{' PushLeftBrace VariableInitializers ',' '}'
 VariableInitializers ::= VariableInitializer
 VariableInitializers ::= VariableInitializers ',' VariableInitializer
 Block ::= OpenBlock '{' BlockStatementsopt '}'
 OpenBlock ::= //$Empty
 BlockStatements ::= BlockStatement
 BlockStatements ::= BlockStatements BlockStatement
 BlockStatementopt ::= BlockStatementopt0
 BlockStatementopt0 ::= /*->*/  //$Empty
 BlockStatementopt0 ::= /*->*/  BlockStatement
 BlockStatement ::= /*->*/  LocalVariableDeclarationStatement
 BlockStatement ::= /*->*/  Statement
 BlockStatement ::= /*->*/  ClassDeclaration
 BlockStatement ::= /*->*/  RecordDeclaration
 BlockStatement ::= InterfaceDeclaration
 BlockStatement ::= AnnotationTypeDeclaration
 BlockStatement ::= EnumDeclaration
 LocalVariableDeclarationStatement ::= LocalVariableDeclaration ';'
 LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
 LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
 PushModifiers ::= //$Empty
 PushModifiersForHeader ::= //$Empty
 PushRealModifiers ::= //$Empty
 Statement ::= /*->*/  StatementWithoutTrailingSubstatement
 Statement ::= /*->*/  LabeledStatement
 Statement ::= /*->*/  IfThenStatement
 Statement ::= /*->*/  IfThenElseStatement
 Statement ::= /*->*/  WhileStatement
 Statement ::= /*->*/  ForStatement
 Statement ::= /*->*/  EnhancedForStatement
 StatementNoShortIf ::= /*->*/  StatementWithoutTrailingSubstatement
 StatementNoShortIf ::= /*->*/  LabeledStatementNoShortIf
 StatementNoShortIf ::= /*->*/  IfThenElseStatementNoShortIf
 StatementNoShortIf ::= /*->*/  WhileStatementNoShortIf
 StatementNoShortIf ::= /*->*/  ForStatementNoShortIf
 StatementNoShortIf ::= /*->*/  EnhancedForStatementNoShortIf
 StatementWithoutTrailingSubstatement ::= /*->*/  AssertStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  Block
 StatementWithoutTrailingSubstatement ::= /*->*/  EmptyStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  ExpressionStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  SwitchStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  DoStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  BreakStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  ContinueStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  ReturnStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  SynchronizedStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  ThrowStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  TryStatement
 StatementWithoutTrailingSubstatement ::= /*->*/  TryStatementWithResources
 StatementWithoutTrailingSubstatement ::= /*->*/  YieldStatement
 EmptyStatement ::= ';'
 LabeledStatement ::= Label ':' Statement
 LabeledStatementNoShortIf ::= Label ':' StatementNoShortIf
 Label ::= 'Identifier'
 ExpressionStatement ::= StatementExpression ';'
 ExpressionStatement ::= ExplicitConstructorInvocation
 StatementExpression ::= Assignment
 StatementExpression ::= PreIncrementExpression
 StatementExpression ::= PreDecrementExpression
 StatementExpression ::= PostIncrementExpression
 StatementExpression ::= PostDecrementExpression
 StatementExpression ::= MethodInvocation
 StatementExpression ::= ClassInstanceCreationExpression
 IfThenStatement ::= 'if' '(' Expression ')' Statement
 IfThenElseStatement ::= 'if' '(' Expression ')' StatementNoShortIf 'else' Statement
 IfThenElseStatementNoShortIf ::= 'if' '(' Expression ')' StatementNoShortIf 'else' StatementNoShortIf
 SwitchStatement ::= 'switch' '(' Expression ')' OpenBlock SwitchBlock
 SwitchBlock ::= '{' '}'
 SwitchBlock ::= '{' SwitchBlockStatements '}'
 SwitchBlock ::= '{' SwitchLabels '}'
 SwitchBlock ::= '{' SwitchBlockStatements SwitchLabels '}'
 SwitchBlockStatements ::= /*->*/  SwitchBlockStatement
 SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
 SwitchBlockStatement ::= /*->*/  SwitchLabeledRule
 SwitchBlockStatement ::= SwitchLabels BlockStatements
 SwitchLabels ::= /*->*/  SwitchLabel
 SwitchLabels ::= SwitchLabels SwitchLabel
 SwitchLabel ::= SwitchLabelCaseLhs ':'
 SwitchLabel ::= 'default' ':'
 UnaryExpressionNotPlusMinus ::= /*->*/  SwitchExpression
 UnaryExpressionNotPlusMinus_NotName ::= /*->*/  SwitchExpression
 SwitchExpression ::= 'switch' '(' Expression ')' OpenBlock SwitchBlock
 SwitchLabeledRule ::= SwitchLabeledExpression
 SwitchLabeledRule ::= SwitchLabeledBlock
 SwitchLabeledRule ::= SwitchLabeledThrowStatement
 SwitchLabeledExpression ::= SwitchLabelExpr Expression ';'
 SwitchLabeledBlock ::= SwitchLabelExpr Block
 SwitchLabeledThrowStatement ::= SwitchLabelExpr ThrowExpression ';'
 SwitchLabelExpr ::= 'default' '->'
 SwitchLabelExpr ::= SwitchLabelCaseLhs 'BeginCaseExpr' '->'
 SwitchLabelCaseLhs ::= 'case' ConstantExpressions
 YieldStatement ::= 'RestrictedIdentifierYield' Expression ';'
 WhileStatement ::= 'while' '(' Expression ')' Statement
 WhileStatementNoShortIf ::= 'while' '(' Expression ')' StatementNoShortIf
 DoStatement ::= 'do' Statement 'while' '(' Expression ')' ';'
 ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' Statement
 ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf
 ForInit ::= StatementExpressionList
 ForInit ::= /*->*/  LocalVariableDeclaration
 ForUpdate ::= /*->*/  StatementExpressionList
 StatementExpressionList ::= /*->*/  StatementExpression
 StatementExpressionList ::= StatementExpressionList ',' StatementExpression
 AssertStatement ::= 'assert' Expression ';'
 AssertStatement ::= 'assert' Expression ':' Expression ';'
 BreakStatement ::= 'break' ';'
 BreakStatement ::= 'break' 'Identifier' ';'
 ContinueStatement ::= 'continue' ';'
 ContinueStatement ::= 'continue' 'Identifier' ';'
 ReturnStatement ::= 'return' Expressionopt ';'
 ThrowStatement ::= 'throw' Expression ';'
 ThrowExpression ::= 'throw' Expression
 SynchronizedStatement ::= OnlySynchronized '(' Expression ')' Block
 OnlySynchronized ::= 'synchronized'
 TryStatement ::= 'try' TryBlock Catches
 TryStatement ::= 'try' TryBlock Catchesopt Finally
 TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt
 TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally
 ResourceSpecification ::= '(' Resources opt_semi ')'
opt_semi ::= //$Empty
opt_semi ::= ';'
 Resources ::= Resource
 Resources ::= Resources TrailingSemiColon Resource
 TrailingSemiColon ::= ';'
 Resource ::= Type PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
 Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
 Resource ::= Name
 Resource ::= FieldAccess
 TryBlock ::= Block ExitTryBlock
 ExitTryBlock ::= //$Empty
 Catches ::= /*->*/  CatchClause
 Catches ::= Catches CatchClause
 CatchClause ::= 'catch' '(' CatchFormalParameter ')' Block
 Finally ::= 'finally' Block
 PushLPAREN ::= '('
 PushRPAREN ::= ')'
 Primary ::= /*->*/  PrimaryNoNewArray
 Primary ::= /*->*/  ArrayCreationWithArrayInitializer
 Primary ::= /*->*/  ArrayCreationWithoutArrayInitializer
 PrimaryNoNewArray ::= /*->*/  Literal
 PrimaryNoNewArray ::= 'this'
 PrimaryNoNewArray ::= PushLPAREN Expression_NotName PushRPAREN
 PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN
 PrimaryNoNewArray ::= /*->*/  ClassInstanceCreationExpression
 PrimaryNoNewArray ::= /*->*/  FieldAccess
 PrimaryNoNewArray ::= Name '.' 'this'
 QualifiedSuperReceiver ::= Name '.' 'super'
 PrimaryNoNewArray ::= Name '.' 'class'
 PrimaryNoNewArray ::= Name Dims '.' 'class'
 PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
 PrimaryNoNewArray ::= PrimitiveType '.' 'class'
 PrimaryNoNewArray ::= /*->*/  MethodInvocation
 PrimaryNoNewArray ::= /*->*/  ArrayAccess
 PrimaryNoNewArray ::= /*->*/  LambdaExpression
 PrimaryNoNewArray ::= /*->*/  ReferenceExpression
 ReferenceExpressionTypeArgumentsAndTrunk ::= ReferenceExpressionTypeArgumentsAndTrunk0
 ReferenceExpressionTypeArgumentsAndTrunk0 ::= OnlyTypeArguments Dimsopt
 ReferenceExpressionTypeArgumentsAndTrunk0 ::= OnlyTypeArguments '.' ClassOrInterfaceType Dimsopt
 ReferenceExpression ::= PrimitiveType Dims '::' NonWildTypeArgumentsopt IdentifierOrNew
 ReferenceExpression ::= Name Dimsopt '::' NonWildTypeArgumentsopt IdentifierOrNew
 ReferenceExpression ::= Name 'BeginTypeArguments' ReferenceExpressionTypeArgumentsAndTrunk '::' NonWildTypeArgumentsopt IdentifierOrNew
 ReferenceExpression ::= Primary '::' NonWildTypeArgumentsopt 'Identifier'
 ReferenceExpression ::= QualifiedSuperReceiver '::' NonWildTypeArgumentsopt 'Identifier'
 ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt 'Identifier'
 NonWildTypeArgumentsopt ::= //$Empty
 NonWildTypeArgumentsopt ::= /*->*/  OnlyTypeArguments
 IdentifierOrNew ::= 'Identifier'
 IdentifierOrNew ::= 'new'
 LambdaExpression ::= LambdaParameters '->' LambdaBody
 NestedLambda ::= //$Empty
 LambdaParameters ::= 'Identifier' NestedLambda
 LambdaParameters ::= /*->*/  'BeginLambda' NestedLambda LambdaParameterList
 ParenthesizedLambdaParameterList ::= LambdaParameterList
 LambdaParameterList ::= /*->*/  PushLPAREN FormalParameterListopt PushRPAREN
 LambdaParameterList ::= /*->*/  PushLPAREN TypeElidedFormalParameterList PushRPAREN
 TypeElidedFormalParameterList ::= /*->*/  TypeElidedFormalParameter
 TypeElidedFormalParameterList ::= TypeElidedFormalParameterList ',' TypeElidedFormalParameter
 TypeElidedFormalParameter ::= Modifiersopt 'Identifier'
 LambdaBody ::= /*->*/  ElidedLeftBraceAndReturn Expression 'ElidedSemicolonAndRightBrace'
 LambdaBody ::= /*->*/  Block
 ElidedLeftBraceAndReturn ::= //$Empty
 AllocationHeader ::= 'new' ClassType '(' ArgumentListopt ')'
 ClassInstanceCreationExpression ::= 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt
 ClassInstanceCreationExpression ::= 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt
 ClassInstanceCreationExpression ::= Primary '.' 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
 ClassInstanceCreationExpression ::= Primary '.' 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
 ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
 ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
 EnterInstanceCreationArgumentList ::= //$Empty
 ClassInstanceCreationExpressionName ::= Name '.' 'new'
 UnqualifiedClassBodyopt ::= //$Empty
 UnqualifiedClassBodyopt ::= UnqualifiedEnterAnonymousClassBody ClassBody
 UnqualifiedEnterAnonymousClassBody ::= //$Empty
 QualifiedClassBodyopt ::= //$Empty
 QualifiedClassBodyopt ::= QualifiedEnterAnonymousClassBody ClassBody
 QualifiedEnterAnonymousClassBody ::= //$Empty
 ArgumentList ::= Expression
 ArgumentList ::= ArgumentList ',' Expression
 ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs
 ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
 ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
 ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
 ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
 ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
 DimWithOrWithOutExprs ::= DimWithOrWithOutExpr
 DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr
 DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' Expression ']'
 DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' ']'
 Dims ::= DimsLoop
 DimsLoop ::= /*->*/  OneDimLoop
 DimsLoop ::= DimsLoop OneDimLoop
 OneDimLoop ::= '[' ']'
 OneDimLoop ::= TypeAnnotations '[' ']'
 FieldAccess ::= Primary '.' 'Identifier'
 FieldAccess ::= 'super' '.' 'Identifier'
 FieldAccess ::= QualifiedSuperReceiver '.' 'Identifier'
 MethodInvocation ::= Name '(' ArgumentListopt ')'
 MethodInvocation ::= Name '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= Primary '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= Primary '.' 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= QualifiedSuperReceiver '.' 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= QualifiedSuperReceiver '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= 'super' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
 MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
 ArrayAccess ::= Name '[' Expression ']'
 ArrayAccess ::= PrimaryNoNewArray '[' Expression ']'
 ArrayAccess ::= ArrayCreationWithArrayInitializer '[' Expression ']'
 PostfixExpression ::= /*->*/  Primary
 PostfixExpression ::= Name
 PostfixExpression ::= /*->*/  PostIncrementExpression
 PostfixExpression ::= /*->*/  PostDecrementExpression
 PostIncrementExpression ::= PostfixExpression '++'
 PostDecrementExpression ::= PostfixExpression '--'
 PushPosition ::= //$Empty
 UnaryExpression ::= /*->*/  PreIncrementExpression
 UnaryExpression ::= /*->*/  PreDecrementExpression
 UnaryExpression ::= '+' PushPosition UnaryExpression
 UnaryExpression ::= '-' PushPosition UnaryExpression
 UnaryExpression ::= /*->*/  UnaryExpressionNotPlusMinus
 PreIncrementExpression ::= '++' PushPosition UnaryExpression
 PreDecrementExpression ::= '--' PushPosition UnaryExpression
 UnaryExpressionNotPlusMinus ::= /*->*/  PostfixExpression
 UnaryExpressionNotPlusMinus ::= '~' PushPosition UnaryExpression
 UnaryExpressionNotPlusMinus ::= '!' PushPosition UnaryExpression
 UnaryExpressionNotPlusMinus ::= /*->*/  CastExpression
 CastExpression ::= PushLPAREN PrimitiveType Dimsopt AdditionalBoundsListOpt PushRPAREN InsideCastExpression UnaryExpression
 CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt AdditionalBoundsListOpt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
 CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt AdditionalBoundsListOpt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
 CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
 CastExpression ::= 'BeginIntersectionCast' PushLPAREN CastNameAndBounds PushRPAREN InsideCastExpressionLL1WithBounds UnaryExpressionNotPlusMinus
 CastExpression ::= PushLPAREN Name Dims AdditionalBoundsListOpt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
 AdditionalBoundsListOpt ::= //$Empty
 AdditionalBoundsListOpt ::= /*->*/  AdditionalBoundList
 ParenthesizedCastNameAndBounds ::= '(' CastNameAndBounds ')'
 CastNameAndBounds ::= /*->*/  Name AdditionalBoundList
 OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
 InsideCastExpression ::= //$Empty
 InsideCastExpressionLL1 ::= //$Empty
 InsideCastExpressionLL1WithBounds ::= //$Empty
 InsideCastExpressionWithQualifiedGenerics ::= //$Empty
 MultiplicativeExpression ::= /*->*/  UnaryExpression
 MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
 MultiplicativeExpression ::= MultiplicativeExpression '/' UnaryExpression
 MultiplicativeExpression ::= MultiplicativeExpression '%' UnaryExpression
 AdditiveExpression ::= /*->*/  MultiplicativeExpression
 AdditiveExpression ::= AdditiveExpression '+' MultiplicativeExpression
 AdditiveExpression ::= AdditiveExpression '-' MultiplicativeExpression
 ShiftExpression ::= /*->*/  AdditiveExpression
 ShiftExpression ::= ShiftExpression '<<' AdditiveExpression
 ShiftExpression ::= ShiftExpression '>>' AdditiveExpression
 ShiftExpression ::= ShiftExpression '>>>' AdditiveExpression
 RelationalExpression ::= /*->*/  ShiftExpression
 RelationalExpression ::= RelationalExpression '<' ShiftExpression
 RelationalExpression ::= RelationalExpression '>' ShiftExpression
 RelationalExpression ::= RelationalExpression '<=' ShiftExpression
 RelationalExpression ::= RelationalExpression '>=' ShiftExpression
 EqualityExpression ::= /*->*/  InstanceofExpression
 EqualityExpression ::= EqualityExpression '==' InstanceofExpression
 EqualityExpression ::= EqualityExpression '!=' InstanceofExpression
 AndExpression ::= /*->*/  EqualityExpression
 AndExpression ::= AndExpression '&' EqualityExpression
 ExclusiveOrExpression ::= /*->*/  AndExpression
 ExclusiveOrExpression ::= ExclusiveOrExpression '^' AndExpression
 InclusiveOrExpression ::= /*->*/  ExclusiveOrExpression
 InclusiveOrExpression ::= InclusiveOrExpression '|' ExclusiveOrExpression
 ConditionalAndExpression ::= /*->*/  InclusiveOrExpression
 ConditionalAndExpression ::= ConditionalAndExpression '&&' InclusiveOrExpression
 ConditionalOrExpression ::= /*->*/  ConditionalAndExpression
 ConditionalOrExpression ::= ConditionalOrExpression '||' ConditionalAndExpression
 ConditionalExpression ::= /*->*/  ConditionalOrExpression
 ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression
 AssignmentExpression ::= /*->*/  ConditionalExpression
 AssignmentExpression ::= /*->*/  Assignment
 Assignment ::= PostfixExpression AssignmentOperator AssignmentExpression
 InvalidArrayInitializerAssignement ::= PostfixExpression AssignmentOperator ArrayInitializer
 Assignment ::= InvalidArrayInitializerAssignement
 AssignmentOperator ::= '='
 AssignmentOperator ::= '*='
 AssignmentOperator ::= '/='
 AssignmentOperator ::= '%='
 AssignmentOperator ::= '+='
 AssignmentOperator ::= '-='
 AssignmentOperator ::= '<<='
 AssignmentOperator ::= '>>='
 AssignmentOperator ::= '>>>='
 AssignmentOperator ::= '&='
 AssignmentOperator ::= '^='
 AssignmentOperator ::= '|='
 Expression ::= AssignmentExpression
 ClassHeaderExtendsopt ::= //$Empty
 ClassHeaderExtendsopt ::= /*->*/  ClassHeaderExtends
 Expressionopt ::= //$Empty
 Expressionopt ::= /*->*/  Expression
 ConstantExpressions ::= /*->*/  ConstantExpression
 ConstantExpressions ::= ConstantExpressions ',' ConstantExpression
 ConstantExpression ::= /*->*/  Expression
 opt_comma ::= /*->*/  //$Empty
 opt_comma ::= /*->*/  ','
 ClassBodyDeclarationsopt ::= //$Empty
 ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations
 Modifiersopt ::= //$Empty
 Modifiersopt ::= Modifiers
 BlockStatementsopt ::= //$Empty
 BlockStatementsopt ::= /*->*/  BlockStatements
 Dimsopt ::= //$Empty
 Dimsopt ::= /*->*/  Dims
 ArgumentListopt ::= //$Empty
 ArgumentListopt ::= /*->*/  ArgumentList
 MethodHeaderThrowsClauseopt ::= //$Empty
 MethodHeaderThrowsClauseopt ::= /*->*/  MethodHeaderThrowsClause
 FormalParameterListopt ::= //$Empty
 FormalParameterListopt ::= /*->*/  FormalParameterList
 ClassHeaderImplementsopt ::= //$Empty
 ClassHeaderImplementsopt ::= /*->*/  ClassHeaderImplements
 ClassHeaderPermittedSubclassesopt ::= //$Empty
 ClassHeaderPermittedSubclassesopt ::= /*->*/  ClassHeaderPermittedSubclasses
 PermittedSubclasses ::= ClassTypeList
 ClassHeaderPermittedSubclasses ::= 'RestrictedIdentifierpermits' ClassTypeList
 InterfaceHeaderPermittedSubClassesAndSubInterfacesopt ::= //$Empty
 InterfaceHeaderPermittedSubClassesAndSubInterfacesopt ::= /*->*/  InterfaceHeaderPermittedSubClassesAndSubInterfaces
 InterfaceHeaderPermittedSubClassesAndSubInterfaces ::= 'RestrictedIdentifierpermits' ClassTypeList
 InterfaceMemberDeclarationsopt ::= //$Empty
 InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations
 NestedType ::= //$Empty
 ForInitopt ::= //$Empty
 ForInitopt ::= /*->*/  ForInit
 ForUpdateopt ::= //$Empty
 ForUpdateopt ::= /*->*/  ForUpdate
 InterfaceHeaderExtendsopt ::= //$Empty
 InterfaceHeaderExtendsopt ::= /*->*/  InterfaceHeaderExtends
 Catchesopt ::= //$Empty
 Catchesopt ::= /*->*/  Catches
 EnumDeclaration ::= EnumHeader EnumBody
 EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt
 EnumHeaderName ::= Modifiersopt 'enum' 'Identifier'
 EnumHeaderName ::= Modifiersopt 'enum' 'Identifier' TypeParameters
 EnumBody ::= '{' EnumBodyDeclarationsopt '}'
 EnumBody ::= '{' ',' EnumBodyDeclarationsopt '}'
 EnumBody ::= '{' EnumConstants ',' EnumBodyDeclarationsopt '}'
 EnumBody ::= '{' EnumConstants EnumBodyDeclarationsopt '}'
 EnumConstants ::= /*->*/  EnumConstant
 EnumConstants ::= EnumConstants ',' EnumConstant
 EnumConstantHeaderName ::= Modifiersopt 'Identifier'
 EnumConstantHeader ::= EnumConstantHeaderName ForceNoDiet Argumentsopt RestoreDiet
 EnumConstant ::= EnumConstantHeader ForceNoDiet ClassBody RestoreDiet
 EnumConstant ::= EnumConstantHeader
 Arguments ::= '(' ArgumentListopt ')'
 Argumentsopt ::= //$Empty
 Argumentsopt ::= /*->*/  Arguments
 EnumDeclarations ::= ';' ClassBodyDeclarationsopt
 EnumBodyDeclarationsopt ::= //$Empty
 EnumBodyDeclarationsopt ::= /*->*/  EnumDeclarations
 EnhancedForStatement ::= EnhancedForStatementHeader Statement
 EnhancedForStatementNoShortIf ::= EnhancedForStatementHeader StatementNoShortIf
 EnhancedForStatementHeaderInit ::= 'for' '(' Type PushModifiers 'Identifier' Dimsopt
 EnhancedForStatementHeaderInit ::= 'for' '(' Modifiers Type PushRealModifiers 'Identifier' Dimsopt
 EnhancedForStatementHeader ::= EnhancedForStatementHeaderInit ':' Expression ')'
 SingleStaticImportDeclaration ::= SingleStaticImportDeclarationName ';'
 SingleStaticImportDeclarationName ::= 'import' 'static' Name RejectTypeAnnotations
 StaticImportOnDemandDeclaration ::= StaticImportOnDemandDeclarationName ';'
 StaticImportOnDemandDeclarationName ::= 'import' 'static' Name '.' RejectTypeAnnotations '*'
 TypeArguments ::= '<' TypeArgumentList1
 OnlyTypeArguments ::= '<' TypeArgumentList1
 TypeArgumentList1 ::= /*->*/  TypeArgument1
 TypeArgumentList1 ::= TypeArgumentList ',' TypeArgument1
 TypeArgumentList ::= /*->*/  TypeArgument
 TypeArgumentList ::= TypeArgumentList ',' TypeArgument
 TypeArgument ::= ReferenceType
 TypeArgument ::= /*->*/  Wildcard
 TypeArgument1 ::= /*->*/  ReferenceType1
 TypeArgument1 ::= /*->*/  Wildcard1
 ReferenceType1 ::= ReferenceType '>'
 ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
 TypeArgumentList2 ::= /*->*/  TypeArgument2
 TypeArgumentList2 ::= TypeArgumentList ',' TypeArgument2
 TypeArgument2 ::= /*->*/  ReferenceType2
 TypeArgument2 ::= /*->*/  Wildcard2
 ReferenceType2 ::= ReferenceType '>>'
 ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
 TypeArgumentList3 ::= /*->*/  TypeArgument3
 TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
 TypeArgument3 ::= /*->*/  ReferenceType3
 TypeArgument3 ::= /*->*/  Wildcard3
 ReferenceType3 ::= ReferenceType '>>>'
 Wildcard ::= TypeAnnotationsopt '?'
 Wildcard ::= TypeAnnotationsopt '?' WildcardBounds
 WildcardBounds ::= 'extends' ReferenceType
 WildcardBounds ::= 'super' ReferenceType
 Wildcard1 ::= TypeAnnotationsopt '?' '>'
 Wildcard1 ::= TypeAnnotationsopt '?' WildcardBounds1
 WildcardBounds1 ::= 'extends' ReferenceType1
 WildcardBounds1 ::= 'super' ReferenceType1
 Wildcard2 ::= TypeAnnotationsopt '?' '>>'
 Wildcard2 ::= TypeAnnotationsopt '?' WildcardBounds2
 WildcardBounds2 ::= 'extends' ReferenceType2
 WildcardBounds2 ::= 'super' ReferenceType2
 Wildcard3 ::= TypeAnnotationsopt '?' '>>>'
 Wildcard3 ::= TypeAnnotationsopt '?' WildcardBounds3
 WildcardBounds3 ::= 'extends' ReferenceType3
 WildcardBounds3 ::= 'super' ReferenceType3
 TypeParameterHeader ::= TypeAnnotationsopt 'Identifier'
 TypeParameters ::= '<' TypeParameterList1
 TypeParameterList ::= /*->*/  TypeParameter
 TypeParameterList ::= TypeParameterList ',' TypeParameter
 TypeParameter ::= /*->*/  TypeParameterHeader
 TypeParameter ::= TypeParameterHeader 'extends' ReferenceType
 TypeParameter ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList
 AdditionalBoundList ::= /*->*/  AdditionalBound
 AdditionalBoundList ::= AdditionalBoundList AdditionalBound
 AdditionalBound ::= '&' ReferenceType
 TypeParameterList1 ::= /*->*/  TypeParameter1
 TypeParameterList1 ::= TypeParameterList ',' TypeParameter1
 TypeParameter1 ::= TypeParameterHeader '>'
 TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType1
 TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList1
 AdditionalBoundList1 ::= /*->*/  AdditionalBound1
 AdditionalBoundList1 ::= AdditionalBoundList AdditionalBound1
 AdditionalBound1 ::= '&' ReferenceType1
 PostfixExpression_NotName ::= /*->*/  Primary
 PostfixExpression_NotName ::= /*->*/  PostIncrementExpression
 PostfixExpression_NotName ::= /*->*/  PostDecrementExpression
 UnaryExpression_NotName ::= /*->*/  PreIncrementExpression
 UnaryExpression_NotName ::= /*->*/  PreDecrementExpression
 UnaryExpression_NotName ::= '+' PushPosition UnaryExpression
 UnaryExpression_NotName ::= '-' PushPosition UnaryExpression
 UnaryExpression_NotName ::= /*->*/  UnaryExpressionNotPlusMinus_NotName
 UnaryExpressionNotPlusMinus_NotName ::= /*->*/  PostfixExpression_NotName
 UnaryExpressionNotPlusMinus_NotName ::= '~' PushPosition UnaryExpression
 UnaryExpressionNotPlusMinus_NotName ::= '!' PushPosition UnaryExpression
 UnaryExpressionNotPlusMinus_NotName ::= /*->*/  CastExpression
 MultiplicativeExpression_NotName ::= /*->*/  UnaryExpression_NotName
 MultiplicativeExpression_NotName ::= MultiplicativeExpression_NotName '*' UnaryExpression
 MultiplicativeExpression_NotName ::= Name '*' UnaryExpression
 MultiplicativeExpression_NotName ::= MultiplicativeExpression_NotName '/' UnaryExpression
 MultiplicativeExpression_NotName ::= Name '/' UnaryExpression
 MultiplicativeExpression_NotName ::= MultiplicativeExpression_NotName '%' UnaryExpression
 MultiplicativeExpression_NotName ::= Name '%' UnaryExpression
 AdditiveExpression_NotName ::= /*->*/  MultiplicativeExpression_NotName
 AdditiveExpression_NotName ::= AdditiveExpression_NotName '+' MultiplicativeExpression
 AdditiveExpression_NotName ::= Name '+' MultiplicativeExpression
 AdditiveExpression_NotName ::= AdditiveExpression_NotName '-' MultiplicativeExpression
 AdditiveExpression_NotName ::= Name '-' MultiplicativeExpression
 ShiftExpression_NotName ::= /*->*/  AdditiveExpression_NotName
 ShiftExpression_NotName ::= ShiftExpression_NotName '<<' AdditiveExpression
 ShiftExpression_NotName ::= Name '<<' AdditiveExpression
 ShiftExpression_NotName ::= ShiftExpression_NotName '>>' AdditiveExpression
 ShiftExpression_NotName ::= Name '>>' AdditiveExpression
 ShiftExpression_NotName ::= ShiftExpression_NotName '>>>' AdditiveExpression
 ShiftExpression_NotName ::= Name '>>>' AdditiveExpression
 RelationalExpression_NotName ::= /*->*/  ShiftExpression_NotName
 RelationalExpression_NotName ::= ShiftExpression_NotName '<' ShiftExpression
 RelationalExpression_NotName ::= Name '<' ShiftExpression
 RelationalExpression_NotName ::= ShiftExpression_NotName '>' ShiftExpression
 RelationalExpression_NotName ::= Name '>' ShiftExpression
 RelationalExpression_NotName ::= RelationalExpression_NotName '<=' ShiftExpression
 RelationalExpression_NotName ::= Name '<=' ShiftExpression
 RelationalExpression_NotName ::= RelationalExpression_NotName '>=' ShiftExpression
 RelationalExpression_NotName ::= Name '>=' ShiftExpression
 InstanceofExpression_NotName ::= /*->*/  RelationalExpression_NotName
 InstanceofExpression_NotName ::= Name InstanceofRHS
 InstanceofExpression_NotName ::= InstanceofExpression_NotName InstanceofRHS
 EqualityExpression_NotName ::= /*->*/  InstanceofExpression_NotName
 EqualityExpression_NotName ::= EqualityExpression_NotName '==' InstanceofExpression
 EqualityExpression_NotName ::= Name '==' InstanceofExpression
 EqualityExpression_NotName ::= EqualityExpression_NotName '!=' InstanceofExpression
 EqualityExpression_NotName ::= Name '!=' InstanceofExpression
 AndExpression_NotName ::= /*->*/  EqualityExpression_NotName
 AndExpression_NotName ::= AndExpression_NotName '&' EqualityExpression
 AndExpression_NotName ::= Name '&' EqualityExpression
 ExclusiveOrExpression_NotName ::= /*->*/  AndExpression_NotName
 ExclusiveOrExpression_NotName ::= ExclusiveOrExpression_NotName '^' AndExpression
 ExclusiveOrExpression_NotName ::= Name '^' AndExpression
 InclusiveOrExpression_NotName ::= /*->*/  ExclusiveOrExpression_NotName
 InclusiveOrExpression_NotName ::= InclusiveOrExpression_NotName '|' ExclusiveOrExpression
 InclusiveOrExpression_NotName ::= Name '|' ExclusiveOrExpression
 ConditionalAndExpression_NotName ::= /*->*/  InclusiveOrExpression_NotName
 ConditionalAndExpression_NotName ::= ConditionalAndExpression_NotName '&&' InclusiveOrExpression
 ConditionalAndExpression_NotName ::= Name '&&' InclusiveOrExpression
 ConditionalOrExpression_NotName ::= /*->*/  ConditionalAndExpression_NotName
 ConditionalOrExpression_NotName ::= ConditionalOrExpression_NotName '||' ConditionalAndExpression
 ConditionalOrExpression_NotName ::= Name '||' ConditionalAndExpression
 ConditionalExpression_NotName ::= /*->*/  ConditionalOrExpression_NotName
 ConditionalExpression_NotName ::= ConditionalOrExpression_NotName '?' Expression ':' ConditionalExpression
 ConditionalExpression_NotName ::= Name '?' Expression ':' ConditionalExpression
 AssignmentExpression_NotName ::= /*->*/  ConditionalExpression_NotName
 AssignmentExpression_NotName ::= /*->*/  Assignment
 Expression_NotName ::= /*->*/  AssignmentExpression_NotName
 AnnotationTypeDeclarationHeaderName ::= Modifiers '@' PushRealModifiers 'interface' 'Identifier'
 AnnotationTypeDeclarationHeaderName ::= Modifiers '@' PushRealModifiers 'interface' 'Identifier' TypeParameters
 AnnotationTypeDeclarationHeaderName ::= '@' PushModifiersForHeader 'interface' 'Identifier' TypeParameters
 AnnotationTypeDeclarationHeaderName ::= '@' PushModifiersForHeader 'interface' 'Identifier'
 AnnotationTypeDeclarationHeader ::= AnnotationTypeDeclarationHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt
 AnnotationTypeDeclaration ::= AnnotationTypeDeclarationHeader AnnotationTypeBody
 AnnotationTypeBody ::= '{' AnnotationTypeMemberDeclarationsopt '}'
 AnnotationTypeMemberDeclarationsopt ::= //$Empty
 AnnotationTypeMemberDeclarationsopt ::= NestedType AnnotationTypeMemberDeclarations
 AnnotationTypeMemberDeclarations ::= /*->*/  AnnotationTypeMemberDeclaration
 AnnotationTypeMemberDeclarations ::= AnnotationTypeMemberDeclarations AnnotationTypeMemberDeclaration
 AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
 AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
 AnnotationMethodHeaderDefaultValueopt ::= //$Empty
 AnnotationMethodHeaderDefaultValueopt ::= DefaultValue
 AnnotationMethodHeader ::= AnnotationMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims AnnotationMethodHeaderDefaultValueopt
 AnnotationTypeMemberDeclaration ::= AnnotationMethodHeader ';'
 AnnotationTypeMemberDeclaration ::= /*->*/  ConstantDeclaration
 AnnotationTypeMemberDeclaration ::= /*->*/  ConstructorDeclaration
 AnnotationTypeMemberDeclaration ::= /*->*/  TypeDeclaration
 DefaultValue ::= 'default' MemberValue
 Annotation ::= /*->*/  NormalAnnotation
 Annotation ::= /*->*/  MarkerAnnotation
 Annotation ::= /*->*/  SingleMemberAnnotation
 AnnotationName ::= '@' UnannotatableName
 NormalAnnotation ::= AnnotationName '(' MemberValuePairsopt ')'
 MemberValuePairsopt ::= //$Empty
 MemberValuePairsopt ::= /*->*/  MemberValuePairs
 MemberValuePairs ::= /*->*/  MemberValuePair
 MemberValuePairs ::= MemberValuePairs ',' MemberValuePair
 MemberValuePair ::= SimpleName '=' EnterMemberValue MemberValue ExitMemberValue
 EnterMemberValue ::= //$Empty
 ExitMemberValue ::= //$Empty
 MemberValue ::= /*->*/  ConditionalExpression_NotName
 MemberValue ::= Name
 MemberValue ::= /*->*/  Annotation
 MemberValue ::= /*->*/  MemberValueArrayInitializer
 MemberValueArrayInitializer ::= EnterMemberValueArrayInitializer '{' PushLeftBrace MemberValues ',' '}'
 MemberValueArrayInitializer ::= EnterMemberValueArrayInitializer '{' PushLeftBrace MemberValues '}'
 MemberValueArrayInitializer ::= EnterMemberValueArrayInitializer '{' PushLeftBrace ',' '}'
 MemberValueArrayInitializer ::= EnterMemberValueArrayInitializer '{' PushLeftBrace '}'
 EnterMemberValueArrayInitializer ::= //$Empty
 MemberValues ::= /*->*/  MemberValue
 MemberValues ::= MemberValues ',' MemberValue
 MarkerAnnotation ::= AnnotationName
 SingleMemberAnnotationMemberValue ::= MemberValue
 SingleMemberAnnotation ::= AnnotationName '(' SingleMemberAnnotationMemberValue ')'
 RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
 RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
 RecoveryMethodHeaderName ::= ModifiersWithDefault TypeParameters Type 'Identifier' '('
 RecoveryMethodHeaderName ::= ModifiersWithDefault Type 'Identifier' '('
 RecoveryMethodHeader ::= RecoveryMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims AnnotationMethodHeaderDefaultValueopt
 RecoveryMethodHeader ::= RecoveryMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClause
kuafuwang commented 2 years ago

It's great and useful feature. I love it.

I had implement generate railroad diagram feature on vscode-extension for lpg2 before , but no on LPG2 .Terminal and non-terminal railroad graph for LPG grammars

Can you finish the code which about this feature .

mingodad commented 2 years ago

I need some help understanding the usage of ->, ->?, ::=? and also it seems that LPG2 accepts non alpha characters in identifiers like:

rules_segment ::= RULES_KEY {action_segment}
...
{action_segment} ::= %Empty
{action_segment} ::= {action_segment} action_segment

That makes it trick, probably need a string transformation like I did manually {action_segment} -> action_segment_list.

I could not find a document describing the LPG2 syntax and it's usage (mainly the mentioned ->, ->? and '::=?`). There is any document that describes it ?

kuafuwang commented 2 years ago

It has little document left.in these place. https://github.com/impulse-org/imp.lpg.ide/tree/master/html

https://github.com/A-LPG/LPG2/tree/main/lpg-generator-templates-2.1.00/docs

kuafuwang commented 2 years ago

produces ::= '::=' produces ::= '::=?' produces ::= '->' produces ::= '->?' i think they are all means produces.no different to us

mingodad commented 2 years ago

I've looked a bit further on this and I decided that LPG2 it's not for me I'll have it as a reference for a LALR(k) parser but I doubt I'll use it due to lack of documentation.

Any way the code that generate the EBNF is on the first message.

kuafuwang commented 2 years ago

I've looked a bit further on this and I decided that LPG2 it's not for me I'll have it as a reference for a LALR(k) parser but I doubt I'll use it due to lack of documentation.

Any way the code that generate the EBNF is on the first message.

That's fine. Than you for you code. About documentation . I will try to write some in future. It's a excellent tool but after Philiphe Charles, Robert M. Fuhrer left IBM,. No one maintain it any more.