I am trying to implement a simple program in LEX but it is giving error.
I am doing it in Ubuntu.
Code:%{ #include <stdio.h> %} digit [0-9] letter [A-Za-z] %% /*** Rules section ***/ {letter} { return 1; } %% /*** C Code section ***/ int main(void) { /* Call the lexer, then quit. */ yylex(); return 0; }
Code:text.lex: In function ‘yylex’: text.lex:13: error: ‘letter’ undeclared (first use in this function) text.lex:13: error: (Each undeclared identifier is reported only once text.lex:13: error: for each function it appears in.) text.lex:13: error: expected ‘;’ before ‘}’ token



1Likes
LinkBack URL
About LinkBacks


