Preprocessor Macros Parser

Hi Timur,

Are you tied to the preprocessor (pp) and pp macros? What is your use case?

I recently did some work on what you might call ³syntax macros² [1]. The
definition of a syntax macro captures an AST subtree. Later, when the
macro is called, the subtree is instantiated (i.e. pasted into the AST at
the place of the macro call). This is orthogonal to preprocessor macros:
since pp macros perform textual replacement, they may be more flexible
than syntax macros. On the other hand, syntax macros let you do type
checking at two levels: the ³standard² type checking or semantic analysis
of the language (i.e. C/C++), and checking of whether pasting a syntax
macro in a certain place in the AST is legal (i.e. type checking on the
AST node type). Since a syntax macro captures a subtree of the AST, you
can also perform tree transformations on the macro.

I implemented syntax macros as a language extension, which required quite
a bit of concentrated work. When I had to stop working on this, my
prototype was (and is) far from being complete, certainly not at the level
of the system described in [1].

I hope this helps more than it confuses.

Best regards,

Norman Rink

[1]
https://www.cs.rice.edu/~taha/teaching/05S/511/papers/weise93programmable.p
df