This is the mail archive of the
mailing list for the GCC project.
Re: Working on a new front-end
- From: Matthieu dot Moy at imag dot fr
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Wed, 15 Oct 2003 06:51:01 +0200
- Subject: Re: Working on a new front-end
- Organization: Verimag, STMicroelectronics
- References: <F4F2EBDF8C16D5118B6500508BD32B4D02F8DDBB@EARTH>
"Jack, Paul" <email@example.com> writes:
> The new language will be imperative and have C-like syntax, but I want to
> add LISP-like macros. The macros would be ordinary functions that take a
> pointer to a parse tree as the first parameter; the functions can modify
> those parse trees and actually modify the program before code generation.
Did you have a look at OpenC++ ? This is a preprocessor for C++ which
allows you to do this kind of thing.
For example, in C++, you have the `=' operator, taking a lvalue as a
left operator, and a value on the right. At the meta level, during
preprocessing, you can define an operator `=' taking a parse tree as a
right operand. The example given in the manual is the calculation of
A = B + C - D;
where A, B, C and D are arrays, with only one for loop.