|Usefulness of automatic parse tree generation firstname.lastname@example.org (2004-07-13)|
|Re: Usefulness of automatic parse tree generation email@example.com (Ira Baxter) (2004-07-13)|
|Re: Usefulness of automatic parse tree generation firstname.lastname@example.org (Carl Cerecke) (2004-07-13)|
|Re: Usefulness of automatic parse tree generation email@example.com (Dave) (2004-07-17)|
|Re: Usefulness of automatic parse tree generation firstname.lastname@example.org (Paul B Mann) (2004-07-28)|
|From:||"Paul B Mann" <email@example.com>|
|Date:||28 Jul 2004 12:06:12 -0400|
|References:||04-07-009 04-07-035 04-07-048|
|Posted-Date:||28 Jul 2004 12:06:12 EDT|
> How difficult is it to upgrade an SLR table generator to an LALR
> table generator?
Difficult. There are pitfalls such as the NQLALR (not quite LALR)
> It may be that the user of the library needs to provide rules for
> the transformation.
Yes, the user provides node names, at least.
> If so, what would these rules look like? I'd love to hear from
> anybody that has experience in doing this and can offer sound
> guidance! >
I did it this way in a commercial PG I wrote. The AST turns out to be
what you want.
// Operator precedence goes here
Goal -> Stmt... <eof>
Stmt -> Exp ';'
-> Target '=' Exp ';' +> assign
Target -> <identifier> +> target
Exp -> Primary
-> Exp '+' Exp +> add
-> Exp '-' Exp +> sub
-> Exp '*' Exp +> mul
-> Exp '/' Exp +> div
Primary -> <identifier> +> ident
-> '(' Exp ')'
-> '+' Primary
-> '-' Primary +> neg
-> '@' Primary +> addr
Paul B Mann
Return to the
Search the comp.compilers archives again.