Re: Usefulness of automatic parse tree generation

Carl Cerecke <cdc@maxnet.co.nz>
13 Jul 2004 22:34:00 -0400

          From comp.compilers

Related articles
Usefulness of automatic parse tree generation better_cs_now@yahoo.com (2004-07-13)
Re: Usefulness of automatic parse tree generation idbaxter@semdesigns.com (Ira Baxter) (2004-07-13)
Re: Usefulness of automatic parse tree generation cdc@maxnet.co.nz (Carl Cerecke) (2004-07-13)
Re: Usefulness of automatic parse tree generation better_cs_now@yahoo.com (Dave) (2004-07-17)
Re: Usefulness of automatic parse tree generation paulbmann@yahoo.com (Paul B Mann) (2004-07-28)
| List of all articles for this month |

From: Carl Cerecke <cdc@maxnet.co.nz>
Newsgroups: comp.compilers
Date: 13 Jul 2004 22:34:00 -0400
Organization: TelstraClear
References: 04-07-009
Keywords: parse
Posted-Date: 13 Jul 2004 22:34:00 EDT

Dave wrote:


> 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.


Cheers,
Carl.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.