|Usefulness of automatic parse tree generation email@example.com (2004-07-13)|
|Re: Usefulness of automatic parse tree generation firstname.lastname@example.org (Ira Baxter) (2004-07-13)|
|Re: Usefulness of automatic parse tree generation email@example.com (Carl Cerecke) (2004-07-13)|
|Re: Usefulness of automatic parse tree generation firstname.lastname@example.org (Dave) (2004-07-17)|
|Re: Usefulness of automatic parse tree generation email@example.com (Paul B Mann) (2004-07-28)|
|From:||"Paul B Mann" <firstname.lastname@example.org>|
|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.