On 1 Dec 2007, at 23:07, Natalia Wolyczko wrote:

I'm new to bison, first of all I've tried to write a simple "hello- world" like program using flex/bison. All I want is to see "boom!" message after reading two MLAH tokens, which corresponds to input string of the same name i.e. "mlah".

This works fine, I'm able to see "boom!" message after typing mlah twice, the things which I really don't get is why I see "syntax errror" once mlah is entered third time? What I expected is the situation in which I see "boom!" every two "mlah" occurences.
Can anybody please explain me what's going on?

Because you have written the grammar for a language matching exactly that token sequence and nothing else. If you want to do what you indicated, you need to do recursion - the Bison manual has some sections on that. Also, check out the calculator example - good starting point.

  Hans Aberg




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to