|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:||Carl Cerecke <email@example.com>|
|Date:||13 Jul 2004 22:34:00 -0400|
|Posted-Date:||13 Jul 2004 22:34:00 EDT|
> I'm in the process of writing a generic SLR parser. It takes as input
> SLR parsing tables and a string to be parsed.
If its input is parse tables, then there is very little work to make it
LALR or full LR(1) as well. The big difference between SLR, LR, and LALR
is in the table generation, not the actual parsing machinery.
> So, my question is: How useful would my idea be? In what contexts
> would it be useful to have a tree that mimicked the grammar and a
> particular derivation with that grammar?
Useful for educational purposes. And, perhaps, small simple grammars.
> In what contexts would it not be useful?
Anywhere were a sensible syntax-tree is preferred (e.g.
compiler/translator). Because, I am assuming, the parse tables that
are your parser's input don't have abstract syntax tree (AST)
directions, you'd be stuck with massive trees.
I wrote a parser-generator once that automatically created ASTs, and
struck this very problem. I had to add AST directions to the
parser-generator input file to get a sensible sized-tree that I could
walk over in a reasonable time. It was a huge language though -
produced a parsing automata 4 times the size of Java.
> Is it worth implementing?
Sure. Go for it.
Return to the
Search the comp.compilers archives again.