On Mon, Aug 02, 2004 at 08:51:15PM -0700, John Cohen wrote: > Date: Mon, 02 Aug 2004 23:51:15 -0400 > Mime-Version: 1.0 > Content-Type: text/plain; format=flowed > > Aha! =) > > The last suggestion worked great (thanks!). But still, I still have a small > problem. It won't accept more than one 'statement'. I know why, but can't > fix it. Take a look: > > $ ./a.out > 7 + 9 + 7 + 3 / (5 + 7); > 23.25 > 3 + 3 + 3; > Fatal Error: Parser is hopelessly lost... > > Now, I know why, because my grammar look like this: > in ::= stmt ENDLINE. > stmt(A) ::= expression. { printf("%u\n", a); } > expression(A) ::= INTEGER(B). { A = B; } > expression(A) ::= expression(B) PPLUS expression(C). { A = B + C; } > expression(A) ::= expression(B) PSUB expression(C). { A = B - C; } > ...etc...
John: I'd be interested to see the complete example. Any chance you can provide a link or copy of the calc program? Regards, Mike Chirico