From: | =?ISO-8859-1?Q?J=FCrgen_Kahrs?= <Juergen.Kahrs@vr-web.de> |
Newsgroups: | comp.compilers |
Date: | 19 Dec 2005 00:09:56 -0500 |
Organization: | Compilers Central |
References: | 05-12-036 |
Keywords: | C, design |
Posted-Date: | 19 Dec 2005 00:09:56 EST |
Russ Cox wrote:
> One might envision a syntax like:
>
> if(n ~ Node(OADD, Node(OMUL, ?x, ?y), ?z))
>
> or even
>
> if(n ~ OADD(OMUL(?x, ?y), ?z))
>
> to match (and bind subexpressions in) an expression of
> the form x*y+z. But maybe sometimes I care about the types:
>
> if(n ~ OADD(OMUL(?x, ?y, .type ~ TLONG), ?z))
Do you really have to change the language C for this ? Write a
function which does the matching. Granted, within the limits of C, the
struct to be matched has to be built up before matching, and this
takes some lines of code. But would you really sacrifice compatibility
with C merely for getting some shorthand notation in return ?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.