[Lazarus] Request for student project ideas

Florian Klaempfl florian at freepascal.org
Tue Sep 15 16:43:59 CEST 2009


Hans-Peter Diettrich schrieb:
> Florian Klaempfl schrieb:
> 
>>>> So you are suggesting a preprocessor that reads C and outputs
>>>> Pascal? :-)
>>> No, this were what ToPas does. Instead I suggest to skip the
>>> intermediate Pascal code, and to compile the given source code
>>> immediately.
>>
>> So you want a hybrid pascal/C compiler? Or at which point do you want to
>> do macro expansion and translation of the resulting C?
> 
> All that is done in the compiler front-end, AKA parser.

(preprocessing is never part of the parser, it's a separate compiler
module or part of the, but this doesn't matter)

Just a simple example:

test.h:

#define POINTER(x) typedef T ## x* x
POINTER(float)

test.pas:

unit test;

interface

  {$I test.h}

  POINTER(longint)

implementation

end.

Does this compile? What is compiled into test.ppu? Can I do

unit test2;

  interface

    uses
      test;

    POINTER(string)

  implementation

end.
?




More information about the Lazarus mailing list