lex and yacc parsing question

"Sanjeev" <sanjeev_k_chaudhri@yahoo.com>
23 Aug 2002 11:08:03 -0400

          From comp.compilers

Related articles
lex and yacc parsing question sanjeev_k_chaudhri@yahoo.com (Sanjeev) (2002-08-23)
| List of all articles for this month |
From: "Sanjeev" <sanjeev_k_chaudhri@yahoo.com>
Newsgroups: comp.compilers
Date: 23 Aug 2002 11:08:03 -0400
Organization: http://groups.google.com/
Keywords: lex, yacc, parse, comment
Posted-Date: 23 Aug 2002 11:08:03 EDT

Heloo,


I have an issue in lex and yacc.


Suppose I have written a grammer.


Now I have an input file :


1. always(@posedge clk1)
2. // check syntax below but do not populate the code
3. q = d1;
4. always(@posedge clk2)
5. // check syntax below and also populate the code
6. q1 = d2;


I expect my lex and yacc to perform syntax checking on the full code
but populate only the code above and below the comment line.


i.e. I want in the object model :
1. always(@posedge clk1)
6. q1 = d2;


If I stop sending the tokens to yacc pf the code within the comment
line,, then I can not do syntax checking on that code.


If I return the tokens of the culprit code to yacc but do not populate
it, the line 6 will not get associated with always block in line 1.


Please some one help me do this in one pass of yacc.


Is there any way in which I can make yacc remember its state till line
no. 1 and then again start from the same states on reaching line
number 6. for line number 2 to 5 , i want yacc to create new states
and discard them on reaching line number 6
[Parse the whole thing, set a flag that tells you when to generate code.
-John]


Post a followup to this message

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