On Tue, 28 Jun 2005 07:15:45 +0800, Joel de Guzman
I've recently switched from YACC to Spirit and I've been trying to rewrite some examples from YACC manual, starting with a RPN calculator. Based on http://www.boost.org/libs/spirit/doc/grammar.html I made something like this:
Have you tried the examples? In particular, see spirit/example/fundamental/more_calculators/rpn_calc.cpp
If you have more questions, the proper list for posting Spirit related questions is:
https://lists.sourceforge.net/lists/listinfo/spirit-general
In general, Yacc based grammars don't map directly to Spirit. The LR grammar must first be converted to LL.
Do you have any suggestions for books or tutorials that show how to make proper LL grammars? Solving ambiguities, eliminating left recursion, etc. I learned all of this in college, but I've forgotten most of the finer points since I never had a practical need for a parser before now. I'm currently making a combination RPN/algebraic calculator that will support accurate integer, rational and real calculations. (Maybe complex later.) I never found a Windows calculator that was close enough to my HPs, so Spirit turned out to be just the thing for making one myself. -- Be seeing you.