|lex question email@example.com (Mina Doroudi) (2005-12-02)|
|Re: lex question firstname.lastname@example.org (Nathan Moore) (2005-12-08)|
|Re: lex question email@example.com (toby) (2005-12-08)|
|lex question firstname.lastname@example.org (Antonio Linares) (1999-03-23)|
|Re: lex question email@example.com (Alejandro Dobniewski) (1999-03-28)|
|Re: lex question firstname.lastname@example.org (1999-04-01)|
|Re: lex question email@example.com (Chris F Clark) (1999-04-03)|
|From:||Alejandro Dobniewski <firstname.lastname@example.org>|
|Date:||28 Mar 1999 17:04:22 -0500|
You can do this with just Lex. I don't remember exactly what we did
but it was something like using states to match idfunction and
exp. Then you can do the macro expansion programaticaly in the
rule. You can use Yacc if you want but it may be more problematic
because this is a macro-substitution so you don't really need a
gramatic for exp.
Antonio Linares wrote:
> We are looking for a way to implement C language #define directive for
> #define <idFunction>([<arg list>]) [<exp>]
> #define Max( x, y ) ( x > y)? x: y
> Do you know how to do this using standard lex & yacc ? Any samples ?
> [There's nothing in lex or yacc that makes it automatic, but macro
> expansion is pretty easy, you keep a stack of sources with the real
> input at the bottom and the macros you're expanding on top of that.
Return to the
Search the comp.compilers archives again.