Common prefix resolution #3939
-
Hi guys, I'm new to ANTLR4, I'm working on a project where the language supports the C++ style template, i.e. both type alias and expression can be passed to the template instantiation. The current parse rule looks like this:
Clearly I'm wondering how ANTLR would recognize an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Antlr will take almost any grammar and generate a parser for it. That parser will handle the common prefix. However, the grammar is ambiguous, so Antlr will choose one derivation or the other (likely through "type"). You should fix the grammar. |
Beta Was this translation helpful? Give feedback.
Antlr will take almost any grammar and generate a parser for it. That parser will handle the common prefix. However, the grammar is ambiguous, so Antlr will choose one derivation or the other (likely through "type"). You should fix the grammar.