Antlr plus a SymbolTable is much more powerful and expressive than Antlr alone.
I believe that C++ CAN be parsed by Antlr if you have a good set of SymbolTable classes. All of the constructor vs function and namespace ambiguities as well as templates and inheritance can be resolved by the SymbolTable. The Lexer would process all pre-processor commands. The Parser would validate the source while simultaneously building the SymbolTable and the AST. A TreeParser would do any semantic checks that cannot be done by the parser. Zero or more TreeParsers would transform the AST to apply optimizations. A final TreeParser would perform code generation. The same SymbolTable would be passed to the Parser and all TreeParsers. On Mon, Jul 11, 2011 at 2:51 PM, Loring Craymer <lgcray...@yahoo.com> wrote: > And then you have to figure out how to prune the GLR-generated "forests". > C++ > is nasty; it can be parsed with ANTLR (as shown by NEXT and David Wigg's > adaptions of that grammar), but I believe that the right strategy with > ANTLR is > actually to use multi-pass recognition to sort out the ambiguities. That > has > not been done yet. > > The problem is that C++ cannot be adequately described with a context-free > grammar; you have to do some context-sensitive processing to resolve the > syntax > that is semantically ambiguous. > > --Loring > > > ----- Original Message ---- > > From: The Researcher <researcher0...@gmail.com> > > To: antlr-interest@antlr.org > > Sent: Mon, July 11, 2011 11:25:07 AM > > Subject: [antlr-interest] Can one identify the type of parser needed for > a > >given BNF grammar > > > > Maybe I dreaming but maybe lady luck is with me today. > > > > Does anyone know of program, paper, algorithm that given a BNF grammar > it > > will tell you what type of algorithm/parser can parse it. > > > > Types of algorithms/parsers would be Regular Expression (RE), LL, LR, > LALR, > > GLR, SLR and how much look ahead is needed? > > > > If another website is better for posting this, that would be > appreciated. > > > > The tie into to ANTLR here is that the more I learn about parsing C++ > the > > more the answer comes back GLR. > > > > Thanks Eric > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > > Unsubscribe: > >http://www.antlr.org/mailman/options/antlr-interest/your-email-address > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.