ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
I have searched the internet far and wide (including as much documentation about ANTLR as I could find), and I couldn't find a single answer for which classes of grammars are supported by ANTLR4 (or even ANTLR3). For example, I know that bison and yacc support LALR(1) grammars, which are well-defined. I know that GLR parsers support all context-free languages. I know that ANTLR uses something called LL(), which I can't find much information on, and yet I see examples of people posting grammars like `expr = expr expr` which is clearly ambiguous. This leads me to ask the following questions:
which class of grammars does ANTLR4 accept?
how is this class of grammars similar or different from the one accepted by ANTLR3?
how does ANTLR decide how to parse ambiguous expressions such as expr = expr * expr?
I saw this quote in the ANTLR4 docs:
ANTLR v4 takes whatever you give it--it just doesn't give a crap
However, I was hoping for a more exact description of the accepted grammar class 😉
Hello friends,
I have searched the internet far and wide (including as much documentation about ANTLR as I could find), and I couldn't find a single answer for which classes of grammars are supported by ANTLR4 (or even ANTLR3). For example, I know that bison and yacc support LALR(1) grammars, which are well-defined. I know that GLR parsers support all context-free languages. I know that ANTLR uses something called LL(), which I can't find much information on, and yet I see examples of people posting grammars like `expr = expr expr` which is clearly ambiguous. This leads me to ask the following questions:
expr = expr * expr
?I saw this quote in the ANTLR4 docs:
However, I was hoping for a more exact description of the accepted grammar class 😉