Re: [Flex-help] How to debug bison/flex program? usage of yyerror()

2009-12-30 Thread Marcel Laverdet
You don't change the BNF. The idea is that it's an unexpected token and should never come up. If it does come up you've got a problem. Really you're best off making your scanner be able to handle ALL input no matter what. On Wed, 30 Dec 2009 21:52:46 -0600, Peng Yu wrote: > On Wed, Dec 30, 200

Re: [Flex-help] How to debug bison/flex program? usage of yyerror()

2009-12-30 Thread Peng Yu
On Wed, Dec 30, 2009 at 1:05 PM, Marcel Laverdet wrote: > > >> Do you actually mean '.' matches non newline? > > Yes, apologies :) > >> I made some corrections. Now yylval_string.l becomes the following. You > said yyerror should not be used in the flex file. I'm wondering what I > should use to r

Re: [Flex-help] How to debug bison/flex program? usage of yyerror()

2009-12-30 Thread Marcel Laverdet
> Do you actually mean '.' matches non newline? Yes, apologies :) > I made some corrections. Now yylval_string.l becomes the following. You said yyerror should not be used in the flex file. I'm wondering what I should use to replace the line '. { yyerror("mystery character %c\n", *yytext)

Re: [Flex-help] How to debug bison/flex program? usage of yyerror()

2009-12-30 Thread Peng Yu
On Wed, Dec 30, 2009 at 12:54 AM, Marcel Laverdet wrote: > > > 1) [:space:] is a character class expression. If you want one or more > spaces you would do [[:space:]]+. What your scanner is looking for right > now is one of either ":, s, p, a, c, or e". Does that make sense? Just wrap > it in anot

Re: [Flex-help] How to debug bison/flex program? usage of yyerror()

2009-12-30 Thread Marcel Laverdet
1) [:space:] is a character class expression. If you want one or more spaces you would do [[:space:]]+. What your scanner is looking for right now is one of either ":, s, p, a, c, or e". Does that make sense? Just wrap it in another set of []'s 2) . only matches newline, the documentation is not

How to debug bison/flex program? usage of yyerror()

2009-12-29 Thread Peng Yu
I have the source files listed at the end of the message. I basically want to parse a file with only numbers (separated by spaces) and print the numbers out. It is an overkill to use bison/flex. But I just want to try how to use bison/flex. I need to understand how to debug the program. Could some