How flex parses the flex program code.
Request inputs on how to see the parsing of flex program, by its parser.
The file here seems need be looked for clue, but unable to find which part to look into. By parsing, mean the specific format in which a flex file is organised, and the yywrap(), yylex() functions as used specific to flex. |
probably this? https://stackoverflow.com/questions/...-bison-grammar
|
Quote:
Also, can you please kindly tell what is causing the error, in the given post; as am unable to find the exact token in the input.txt file, where the error occurred. |
Sorry, what exactly the question is? (If it is "who is willing to explain me in details the working of flex program?" then I am not voluntering.)
|
Quote:
Also, can you please kindly tell what is causing the error, in the given post; as am unable to find the exact token in the input.txt file, where the error occurred. |
Please instead of "given post" clearly describe problem.
|
Quote:
Code:
int var(int a, int b){ The error is shown as: Code:
type_specifier -> INT Code:
type_specifier -> INT Next, the code for implementation of the functions specific to flex, i.e. yymore(), yywrap(), yylex(), is found now here. But, assume that the flex would have been created much before the C++ was created, hence there must be a C implementation of flex too. Request some link for the same. |
Your lexical parser never returns ADDOP, MULOP etc
|
Sort of fixed it, see here: https://github.com/lzsiga/stackoverflow_50821203
|
Quote:
Actually, the problem was there since you posted it; but failed to muster courage (to ask); & could muster only on the need for following the same approach is given in the link here. The link is derived from the course page here. The code for the book (preface, code (though in the earlier course web-page too)) followed by the course is also given here. Am unsure of how much seriously I am being taken of by you, but would still venture to go further by requesting on how to run the code (for the same project, as the stated book) here. I hope that with your kind help, the next semester would see me helping my students, in building a compiler in far better way than before. Sorry, as didn't put efforts on my own, but seem to be confused more, and wanted to end the stalemate; rather than not providing any useful inputs to students, the next semester too. -------------- P.S.: Want to add that have used make files for simpler uses, than specified here; and cannot hence progress. |
As a start enter command `make parser`
Mind you, this program is incomplete, it only does [partial] lexical parsing. |
Quote:
The best thing you can do is to learn it. But you wrote: Quote:
But at least you started to ask, which is a good thing. Now you need to understand it too (that will end the stalemate). |
Quote:
Code:
$ make parser |
Here is how it goes in Linux:
Code:
/tmp$ git clone https://github.com/lzsiga/stackoverflow_50821203.git |
1 Attachment(s)
Quote:
Code:
CPPFLAGS := -DYYDEBUG -DYY_NO_UNPUT -DYY_NO_INPUT Code:
make parse Code:
CPPFLAGS := -DYYDEBUG Please tell the reason, for the change in output. |
All times are GMT -5. The time now is 12:34 PM. |