This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Working on a new front-end


"Jack, Paul" <pjack@sfaf.org> 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
expressions like

A = B + C - D;

where A, B, C and D are arrays, with only one for loop. 

http://www.csg.is.titech.ac.jp/~chiba/openc++.html

-- 
Matthieu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]