LR Parsing algorithm
kiddiegrinder
Join Date: 2004-01-09 Member: 25181Members, Constellation
in Off-Topic
<div class="IPBDescription">JAVA</div>Hi,
Im trying to make a java program that will take in a word an use a grammar (context-free) to convert it into a parse tree (an print it out somehow...).
Im just trying to think of how I would do it in a resutling string first like...
word = abcde
grammar =
S -> abcE
E -> de
"abcde -> abcE -> S"
If anyone has looked at parsing before (an how compilers are generated) pm me <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
I've already written a program to convert a CFG -> PDA but that was a lot easier than making a parser...
Any suggestions would be welcome <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
Im trying to make a java program that will take in a word an use a grammar (context-free) to convert it into a parse tree (an print it out somehow...).
Im just trying to think of how I would do it in a resutling string first like...
word = abcde
grammar =
S -> abcE
E -> de
"abcde -> abcE -> S"
If anyone has looked at parsing before (an how compilers are generated) pm me <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
I've already written a program to convert a CFG -> PDA but that was a lot easier than making a parser...
Any suggestions would be welcome <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
Comments
can't be of much help with java but my imageboards use perl context-free grammar thingamadoodles to generate the codes for CAPTCHA, the code was blatantly stolen from here: <a href="http://www.ruf.rice.edu/%7Epound/#werd" target="_blank">http://www.ruf.rice.edu/%7Epound/#werd</a>
<!--QuoteEnd--></div><!--QuoteEEnd-->
Wicked cheers, that should be helpful thanks,
Im also thinking of a way to convert a pushdown automata to a grammar if that would be easier