[Flex-help] Problem generating C file from flex
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Manish K. <mka...@gm...> - 2006-06-27 08:39:30
|
Hello friends, I am new to flex.........I have a .l file which contains statements like this %start KEY ARGS SET cmt literal echo str %{ static int oldstate=KEY; %} When i parse this file using "flex -l -X tsh.l".........The output C file has contents. #line 78 "tsh.l" static int oldstate=KEY; #line 668 "lex.yy.c" #define INITIAL 0 #define KEY 1 #define ARGS 2 #define SET 3 #define cmt 4 #define literal 5 #define echo 6 #define str 7 As can be clearly seen.........KEY is defined after its use due to which compilation fails.....Shouldn't the definitions be before the oldstate=KEY line............Am is missing something ? ....Please help I am using the bison which I have built for HP-ia64 architecture with the config options as "./config --prefix=$MYPATH". However when I use the flex which is already installed on the machine it defines the keywords properly....ie..before their use........What should be the config options. -- Thanks & Regards, ******************************************** Manish Katiyar Ozone 2, SP Infocity (Software Park), New Survey #208 Manjari Stud Farms Ltd., Phursungi Village, Haveli Taluka, Saswad Road, Hadapsar, Pune - 412308, India *********************************************** |