1,105,456 Community Members

Compile And Exectue Flex/Bison files

Member Avatar
fantasma
Junior Poster in Training
60 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Greetings,

I've got a working flex/bison parser that I would like to run from an exe file. However, I can't find the knowledge to achieve that.

Do I need to create a C file, with an exec function to call the files? If so, what files do I call in the exec? Anyone knows how to do something like that?

I really need a hint for this one!

Cheers!

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
0
 

flex and bison generate C code from their respective sources (.l and .y). You have to compile them and link resulting objects with the rest of your application. At some point the application calls yyparse() (which is the entry point to the parser).

If you have more specific question, please elaborate.

Member Avatar
fantasma
Junior Poster in Training
60 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

I have those files. something.l and something.y and I need to create an exe in order to, in a JAVA application do something like "cmd executable.exe" < "filetobeparsed" + "parsedfile.xml"

How to make that exe is my question, since I don't have a clue in how to do it

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
0
 

At the command prompt, typing flex something.l gives you lex.yy.c file. Similarly, bison something.y generates yy.tab.c and yy.tab.h files. You may or may not write another C file with main() calling yyparse - inspect something.y for a presence of suitable main(). Assuming it is already there (and assuming gcc as a compiler), type

gcc -o executable yy.tab.c lex.yy.c

. How to integrate it into Java, I have less clue than you.

PS: of course, you need flex and bison executables.

Member Avatar
fantasma
Junior Poster in Training
60 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you! I'll try and integrate with JAVA! ;)

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article