Hi everyone,

i've started to read the lex and yacc book and the bison and flex book. now in the first example they have the following code:

%{
/**
 * First example program for flex
 *
 */
%}

%%

is |
am |
are |
where |
was |
be |
being |
been |
do |
does |
did |
should |
can |
could |
has |
have |
had |
go { printf("%s is a verb\n", yytext); }

[a-zA-Z]+ { printf("%s is not a verb", yytext); }

.|\n { ECHO; /* normal default anyway */ }

%%

int main(int argc, char **argv)
{
    yylex();
}

Now my question is when i enter one of the verbs it's working normaly like expected, but when i enter for example 234someword i also get the messsage %s is not a verb but i've no rule saying that, i've only [a-zA-Z]+ to catch this situation, why does he also react on word that begin with a number ??


best regards!




_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to