|Lex , Yacc Problem email@example.com (2003-09-14)|
|Re: Lex , Yacc Problem firstname.lastname@example.org (Jens Kallup) (2003-09-22)|
|Re: Lex , Yacc Problem email@example.com (2003-09-22)|
|Re: Lex , Yacc Problem firstname.lastname@example.org (2003-09-23)|
|Date:||14 Sep 2003 17:02:23 -0400|
|Posted-Date:||14 Sep 2003 17:02:23 EDT|
Hello all ,
Actually I developing assembler for xyz processor. I am having some
interesting problem with current implementation.
Problem definition :
Consider assembly code
This is giving me error because there are no balance paranthesis . But
as we are in #if 0 block logically (test) should not be considered
(check with C preprocessor) with the same example. (I used GCC)
Actually I want to ignore the part ((test) part and
assume that it is #if 0
Some how I come to know I am in #if 0 block which
parsing for 2nd #if statement.
Requriement : Once I encounter second #if I want to insert a string "
\n " in the input so that lexer will see the second #if statement as
#if 0 ((test). How can I achieve this functionality in lex. Can I
insert some string in input file in the run time ? Or is there any
other way to achive the similar functionality..
[Lex can't count nesting levels by itself, nor can it evaluate expressions.
You can certainly help it out with code of your own that counts #if and #endif
lines and ignores them. -John]
Return to the
Search the comp.compilers archives again.