[Lazarus] Parser

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jul 1 16:48:59 CEST 2010


Michael Schnell schrieb:

> In fact I already missed sadly a fully working preprocessor (to be 
> activated optionally). This does help with Pascal sources from time to 
> time (in fact I do like macros better than generics :) ).

You could use the scanner/preprocessor part of ToPas, if you want an 
fully conforming C preprocessor. I think that I dropped this project 
from ToPas, but it could be added again without problems. IIRC Skalogryz 
currently is porting all that stuff from Delphi to Lazarus...


> I don't see why simply calling the gcc preprocessor is not a viable 
> option (at least with Lazarus on Linux). Supposedly for a better 
> integration a Pascal based workalike preprocessor might be better.

The C preprocessor most probably depends on C syntax (strings and other 
literals...), so its use may be restricted to such source code. AFAIR 
the C90 standard (C98 for sure) already required that the preprocessor 
is an integral part of the compiler, so that up-to-date stand-alone 
preprocessors may be rare. And not all of them comply to the standard, 
with regards to proper macro expansion. I know about two extreme cases, 
where the Sinix(?) preprocessor insisted in expanding #defined symbols 
even in string literals, and the Microsoft preprocessor has other 
incompatible ideas about macro expansion and comments; you'll find more 
details in the ToPas documentation...

DoDi





More information about the Lazarus mailing list