[antlr-interest] Can one identify the type of parser needed for a given BNF grammar

Douglas Godfrey douglasgodfrey at gmail.com
Mon Jul 11 18:48:45 PDT 2011


For some time I have been proposing that a full function SymbolTable class
be added to
Antlr itself and made available as direct operations in the Antlr grammar.
Instead of having
to use target language specific productions, you would use target language
independent
SymbolTable class functions directly in the Antlr code.

The same symbol table classes would be used by Antlr itself to parse the
Antlr grammar
and by Antlr generated Parsers and TreeParsers.


i.e.

new_variable[list<string> TypeAttributes] :
    (Identifier.IsNewSymbol())=>Identifier.NewVariable(TypeAttributes);

instead of

new_variable[list<string> TypeAttributes] :
    { pSymbolTable->IsNewSymbol(LT(1).text) }?
    Identifier
    { pSymbolTable->NewVariable(TypeAttributes); };



On Mon, Jul 11, 2011 at 7:53 PM, The Researcher <researcher0x00 at gmail.com>wrote:

> Douglas and Loring,
>
> I truly appreciate your feedback and will be taking the time to understand
> it in enough detail so that I can explain it to others by creating some
> prototype code.
>
> The only other point of note is that if others are quietly reading this
> thread and are interested in creating a C++ parser for ANTLR, then please
> jump in with a question. I don't consider this my thread, but a public
> thread to learn how to parse C++ with ANTLR.
>
> Thanks Eric
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list