unrecognized rule error in lex {lineo++;} -
I got some errors in my linux code, maybe somebody knows what I did wrong ...
16 %% 17 {ws} {/ * no action and no refunds} 18} {{9line} {lineO +};} 20 {number} {tokenval = Yytext; Return (NUM);} 21 {ID} {22 int pt = 0; 23p = lookup (yytext); 24 if (P == 0) 25p = Enter (YETtext, ID); 26 Toknaval = P; 27 Return Simblate [P]. Towne; 28 29} 30 31 & lt; & Lt; EOF & gt; & Gt; {Refunded;} 32 {Tokel = None; Returns yytext [0];} 33 34 35 %% I'm a newbie in this type of technique, and I spend much time about it but without any positive results Below the errors from the console:
new.l: 21: unrecognized rule new.l: 28: unrecognized rule new.l: 28: unrecognized rule new.l: 36: an action in EOF New.l: 36: unrecognized rule new.l: 36: create deadly parse error: *** [lex.yy.c] error 1 when I delete that line The code is bad (line: 21-32) Uje that error:
new.l: 19: 2: error: a row ??? Undeclared (first use in this function) {newline} {lineo ++;}
-
line 18 ( {} ) is simply false; Flex will behave as a pattern, no action. -
You might write lineno (i.e., "a way to type line NACR" which is an abbreviation for "line number".) But Have you declared it somewhere? Or do you want to use yylineno -
Have you defined {id} ? The error message shows that you did not, but you did not paste your definitions. -
In line 32, the default rule pattern is . : {token = none; Yytext [0];} -
Have you read the work?
Above, as a 3 point replacement, definition:
id {letter} ({letter} | {digit}) * is incorrect because can not contain unquoted whitespace in regular expressions. You can call it id {letter} ({letter } | {Digit}) *
Comments
Post a Comment