lex question

"Antonio Linares" <alinares@fivetech.com>
23 Mar 1999 12:29:02 -0500

          From comp.compilers

Related articles
lex question dormina@winnipeg-lnx.cc.gatech.edu (Mina Doroudi) (2005-12-02)
Re: lex question nathan.moore@cox.net (Nathan Moore) (2005-12-08)
Re: lex question toby@telegraphics.com.au (toby) (2005-12-08)
lex question alinares@fivetech.com (Antonio Linares) (1999-03-23)
Re: lex question adobni@itron.com.ar (Alejandro Dobniewski) (1999-03-28)
Re: lex question rkrayhawk@aol.com (1999-04-01)
Re: lex question cfc@world.std.com (Chris F Clark) (1999-04-03)
re: lex question scinar@ug.bcc.bilkent.edu.tr (Sukru Cinar) (1999-04-18)
| List of all articles for this month |

From: "Antonio Linares" <alinares@fivetech.com>
Newsgroups: comp.compilers
Date: 23 Mar 1999 12:29:02 -0500
Organization: Telefonica Transmision de Datos
Keywords: C, parse, comment

We are looking for a way to implement C language #define directive for
expressions:


      #define <idFunction>([<arg list>]) [<exp>]


example:


      #define Max( x, y ) ( x > y)? x: y


Do you know how to do this using standard lex & yacc ? Any samples ?


regards,


A.L.
[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.
-John]


Post a followup to this message

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