Re: Advice on Writing a Parser Generator

Lex Spoon <lex@cc.gatech.edu>
23 Aug 2003 23:11:11 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: Advice on Writing a Parser Generator chief@ockhamstyle.com (Mykola Rabchevskiy) (2003-08-15)
Re: Advice on Writing a Parser Generator rda@lemma-one.com (Rob Arthan) (2003-08-15)
Re: Advice on Writing a Parser Generator scherzin@fmi.uni-passau.de (2003-08-15)
Re: Advice on Writing a Parser Generator joachim.durchholz@web.de (Joachim Durchholz) (2003-08-20)
RE: Advice on Writing a Parser Generator dyessick@cs.ua.edu (Don Yessick) (2003-08-20)
Re: Advice on Writing a Parser Generator cfc@shell01.TheWorld.com (Chris F Clark) (2003-08-23)
Re: Advice on Writing a Parser Generator lex@cc.gatech.edu (Lex Spoon) (2003-08-23)
Re: Advice on Writing a Parser Generator jhayes2@oswego.edu (2003-08-23)
Re: Advice on Writing a Parser Generator usenet0@skora.net (Thomas Skora) (2003-09-04)
Re: Advice on Writing a Parser Generator robert.thorpe@antenova.com (Rob Thorpe) (2003-09-04)
| List of all articles for this month |

From: Lex Spoon <lex@cc.gatech.edu>
Newsgroups: comp.compilers
Date: 23 Aug 2003 23:11:11 -0400
Organization: Georgia Institute of Technology
References: 03-08-027 03-08-046 03-08-065
Keywords: parse, tools, practice
Posted-Date: 23 Aug 2003 23:11:10 EDT

"Don Yessick" <dyessick@cs.ua.edu> writes:


>>> I plan to write a parser generator, very similar to YACC, for Java.
>>
>>You do know about JavaCC, right?
>>
>>(I haven't used it myself, but a colleague has, so I know it "works".
>>On t'other hand, having been stung badly by trying to use flex and
>>bison to generate lexers/parsers for a couple of languages, at the
>>moment I'm in the "we don't need no adjectiving parser generators!"
>>camp. "The wheel turns, does it not, Ambassador?")
>
> JavaCC generates recursive descent compilers and doesn't really look
> much like YACC either.


If you are interested in different--which is a good thing if you are
writing a new parser generator--it may be worth perusing SmaCC. Even
if you can't read Smalltalk, it should be interesting to look through
the tutorial and, if you spend the time to get it running on your
machine, to flip through the UI and see what's there.


        http://www.refactory.com/Software/SmaCC/


In general, SmaCC has you developing your parser interactively. You
can put test input in one of the windows, and then whenever you like
ask for it to tokenize, parse, or parse-with-actions your test data
and inspect the result in a debugger.


Also, one of the neat little things it does (or at least, used to do,
the last time I tried it) was to give you a choice of parsing
algorithms to try. You can try for an LL parser, and if that fails
move on to more complex ones. I dunno how useful this is in practice,
but it's kinda neat to just switch a menu choice and get a new parsing
algorithm.




Overall, a SmaCC-like UI would be difficult in C (or equivalently,
less featureful in C), but it might work well in Java due to the
reflection and loadable classes.






Leix


Post a followup to this message

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