B
Ben Bacarisse
BartC said:Well, I've given up on that, because it's not up to the job. As I've said,
I'm using an external tool to convert source code in a kind of hybrid
language to what is considered normal C code.
You should have given up in it for it for other reasons, as you solution
illustrates perfectly: if syntax-disrupting macros are ever used, you
can't implement a simple syntax converter without either implementing a
full C pre-processor or running the source though one first. The former
is tedious and the latter makes it hard to keep things readable.
There is a fine tradition (on Unix at least) of writing what have become
know as "little languages" -- small syntax layers over a low-level
language to produce a higher-level one (ratfor and grap spring to mind,
but I am sure there are others) so you are in good company with this
solution. Lex and YACC were supposed to make this easy but they never
quite made it trivial (I'm looking forward to Perl 6 for this purpose).
<snip>