bison reentrant parser with yyFlexLexer::yylex()

basireddym@rediffmail.com (manohar)
7 Jan 2003 23:30:24 -0500

          From comp.compilers

Related articles
bison reentrant parser with yyFlexLexer::yylex() basireddym@rediffmail.com (2003-01-07)
| List of all articles for this month |
From: basireddym@rediffmail.com (manohar)
Newsgroups: comp.compilers
Date: 7 Jan 2003 23:30:24 -0500
Organization: http://groups.google.com/
Keywords: yacc, lex, question
Posted-Date: 07 Jan 2003 23:30:24 EST

hi friends,


I am trying to develope a reentrant parser with bison using c++
scanner(flex with -+ option).I am getting some problems while
integrating c++ object with yyparse().i have no idea how to integrate
c++ scanner with yyparse(). i have following questions,


1) for reentrant parser,yylex is parameterised(such as yylex(YYSTYPE
*lvalp,..)),but in FlexLexer.h "yylex" is declared as pure virtual
function.
how can i manage to overload "yylex" with parameters.pls explain me
with an example.


2)i want scanner to read input from a file.type of yyin is istream.i
did as follows to as assign input file to yyin


suppose "x.txt" is the file, which is to be read by scanner.
fstream file("x.txt");
file.open(ios::in);
..
..
yylex(&file,&cout);
..




is this the correct way?
pls provide an example program which uses reentrant parser with c++
scanner.
Any help would be greatly appreciated.
regards,
mano


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.