Implementing yacc/lex
I have been working on making a parser for a file format. yacc/lex were what I was recommended to use. I have read several guides and I have a good beginning grasp of it. I have been able to make a program that does basic lexical analysis on strings and prints an analysis of command line input.
The problem I am having is that I cannot find a guide anywhere on how to implement the parser in a C++ program. I am planning a C++ class for the file format, such that a file object is initialized with a file path and it then uses the parser to gather information from the file and store it in objects. How do I call the parser from another file, rather than compile it into an executable? I am using the GNU tools. |
Quote:
(That is, if I understand your question correctly. :)) |
So, if I understand correctly, I just compile the y.tab.c and lex.yy.c together with my fileClass.cpp? In that case, does the yacc file need a main function?
|
All times are GMT -5. The time now is 03:23 PM. |