antlrworks2 - AntlrWorks 2 output -
so using antlrworks 2, working on rather large grammar. problem in grammar there multiple ambiguities trying work through.
i wondering if there way interpret rules invoked when there failure.
for instance, when run rule following output
[@0,0:1='99',<20>,1:0] [@1,2:1='<eof>',<-1>,1:2] line 1:0 mismatched input '99' expecting digit2 (dummy 99)
i wondering [@0,0:1='99',<20>,1:0]
means. @0
or <20>
have relationship rule number in grammar or ?
here breakdown of default token formatting.
[@{tokenindex},{startindex}:{stopindex}={text},<{tokentype}>,{line}:{column}]
the {tokentype}
field corresponds particular lexer rule (the constant declared in generated lexer). however, -> type(x)
command can used in lexer rule reassign tokens produced rule type. if value 20
assigned token named foo
, first token in listing produced either lexer rule named foo
or lexer rule containing action -> type(foo)
or have user-defined action explicitly assigns type foo
token produced other rule (this code wrote, not code generated antlr).
Comments
Post a Comment