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

Douglas Godfrey douglasgodfrey at gmail.com
Tue Jul 12 02:35:25 PDT 2011


You can always resolve an inline declaration like the one below either by
the
syntax of the statement or by the SymbolTable or by the default rule that
ambiguous statements that look like a declaration are a declaration. The
SymbolTable is required but an AST and TreeParser is not.

TBuffer(123) foo;

Forward references to a class member may require an AST and TreeParser but
they are not common. The problem you list below cannot happen if the member
functions are defined in a separate C++ file and would not happen if the
member
variables are declared before the member functions. This is the 10% case.


see <
http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.vacpp7a.doc%2Flanguage%2Fref%2Fclrc08cplr403.htm
>

On Mon, Jul 11, 2011 at 11:14 PM, Ron Burk <ronburk at gmail.com> wrote:

> > Most C++ programs will not have any
> > statements
> > that cannot be resolved inline in the parser and would need to be
> resolved
> > in a later AST
> > TreeParser phase.
>
> Hmmm? Surely a great many C++ programs rely extensively on
> class libraries, and surely most of those make extensive use of
> inline declarations.
>
> struct TBuffer
>    {
>    void    Grow(size_t NewSize) { Buffer = realloc(Buffer, NewSize);
> } /* wtf is Buffer? */
>    char*  Buffer;    /* only later do we know what 'Buffer' refers to */
>    };
>
> How do you "resolve inline" class inline declarations that invariably refer
> to a class that is not yet fully defined?
>
> s/will not have any/will have many/
>
> Use an abstract syntax tree or some form of token reprocessing,
> what other choices are there? Neither way qualifies as "inline processing"
> I would think...
>
> 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