Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: meta/syntax/antlr/antlr4/zaytsev/extracted
Source used for this grammar: Vadim Zaytsev, GrammarLab, grammarlab::extract::ANTLR4
, 13 October 2014
OptionsSpec
, SetElement
, LexerCommand
, LexerCommands
, EbnfSuffix
, LexerAlt
, LexerAtom
, Range
, Element
, OptionValue
, ModeSpec
, RuleBlock
, Atom
, DelegateGrammars
, ElementOption
, ExceptionGroup
, LexerElement
, RuleModifier
, RuleAction
, RulePrequel
, Ebnf
, BlockSet
, Option
, TokensSpec
, RuleSpec
, Action
, ParserRuleSpec
, LabeledAlt
, ActionScopeName
, LabeledElement
, PrequelConstruct
, ThrowsSpec
, LexerRule
, Alternative
, Block
, GrammarType
, LexerBlock
, ANTLR4Grammar
, LocalsSpec
, LabeledLexerElement
, DelegateGrammar
, ElementOptions
, RuleReturns
, AltList
), 1 root (ANTLR4Grammar
), 0 top (—), 6 bottom (ARG_ACTION
5, ACTION
7, STRING_LITERAL
7, Id
25, INT
2, LEXER_CHAR_SET
).OptionsSpec ::= "options" "{" Option ";" "}"
SetElement ::= Range
SetElement ::=
STRING_LITERAL ElementOptions
SetElement ::=
Id ElementOptions
LexerCommand ::= "mode" "(" Id INT ")"Id
LexerCommands ::= "->" LexerCommand ","
EbnfSuffix ::= "+""*""?" "?"
LexerAlt ::= LexerElementLexerCommands
LexerAtom ::= Range
LexerAtom ::= LEXER_CHAR_SET
LexerAtom ::= "." ElementOptions
LexerAtom ::= "~" SetElement BlockSet
LexerAtom ::=Id STRING_LITERAL ElementOptions
Range ::=
STRING_LITERAL ".." STRING_LITERAL
Element ::=
LabeledElement EbnfSuffix
Element ::= ACTION "?"
Element ::=
Atom EbnfSuffix
Element ::= Ebnf
OptionValue ::= Id "." Id
OptionValue ::= INT
OptionValue ::= ACTION
OptionValue ::= STRING_LITERAL
ModeSpec ::= "mode" Id ";" LexerRule
RuleBlock ::= "|"LabeledAlt
Atom ::= "." ElementOptions
Atom ::= Id ARG_ACTIONElementOptions
Atom ::= Range
Atom ::= "~" SetElement BlockSet
Atom ::=Id STRING_LITERAL ElementOptions
DelegateGrammars ::= "import" DelegateGrammar "," ";"
ElementOption ::= Id "=" Id STRING_LITERAL
ExceptionGroup ::= "catch" ARG_ACTION ACTION "finally" ACTION
LexerElement ::=
LabeledLexerElement EbnfSuffix
LexerElement ::=
LexerBlock EbnfSuffix
LexerElement ::=
LexerAtom EbnfSuffix
LexerElement ::= ACTION "?"
RuleModifier ::=
"private"
RuleModifier ::=
"fragment"
RuleModifier ::=
"public"
RuleModifier ::=
"protected"
RuleAction ::=
"@" Id ACTION
RulePrequel ::= RuleAction
RulePrequel ::= OptionsSpec
Ebnf ::=
Block EbnfSuffix
BlockSet ::= "(" SetElement "|" ")"
Option ::=
Id "=" OptionValue
TokensSpec ::= "tokens" "{" Id "," "}"
RuleSpec ::= LexerRule
RuleSpec ::= ParserRuleSpec
Action ::= "@" ActionScopeName "::" Id ACTION
ParserRuleSpec ::= RuleModifier":" RuleBlock ";" ExceptionGroupId ARG_ACTION RuleReturns ThrowsSpec LocalsSpec RulePrequel
LabeledAlt ::= Alternative "#" Id
ActionScopeName ::=
"parser"
ActionScopeName ::=
"lexer"
ActionScopeName ::= Id
LabeledElement ::= Id "=""+=" Atom Block
PrequelConstruct ::= OptionsSpec
PrequelConstruct ::= Action
PrequelConstruct ::= DelegateGrammars
PrequelConstruct ::= TokensSpec
ThrowsSpec ::= "throws" Id ","
LexerRule ::= "fragment" Id ":" LexerAlt "|" ";"
Alternative ::= ElementOptionsElement
Block ::= "(" OptionsSpec RuleAction ":" AltList ")"
GrammarType ::= "lexer""parser" "grammar"
LexerBlock ::= "(" LexerAlt "|" ")"
ANTLR4Grammar ::= GrammarType Id ";" PrequelConstruct RuleSpec ModeSpec
LocalsSpec ::=
"locals" ARG_ACTION
LabeledLexerElement ::= Id "=""+=" LexerAtom Block
DelegateGrammar ::= Id "=" Id
ElementOptions ::= "<" ElementOption "," ">"
RuleReturns ::=
"returns" ARG_ACTION
AltList ::= "|"Alternative