[Lazarus] Parser

Marco van de Voort marcov at stack.nl
Thu Jul 1 10:57:06 CEST 2010


On Thu, Jul 01, 2010 at 10:21:30AM +0200, Michael Schnell wrote:
>   On 07/01/2010 10:00 AM, Florian Klaempfl wrote:
> > Even if FPC supported such a mess, this won't solve the fundamental
> > problem with C headers: they work only properly if every used header is
> > compiled for each source file again
> 
> Yep. Thats a fundamental philosophy of C.

You make it sound like it is some deep philosophical decision, while in fact
they did this because their PDP-8 was short on memory, and they separated
the compilation stages as much as possible to maximize the program that
could be compiled.

However I haven't really seen a compilation unit that exhausts my 4GB memory
(and then I'm not even speaking about 64-bit)

> In fact there is a compiler flag with gcc to compile all files of a
> project as if there were a single source: simulated includes instead of
> linking.In fact there are C compilers that don't support linking at all
> and just compile a source file (with includes) directly to an executable.

Yes, and this is why gcc and most other C compilers have a totally manual
build systems, where you have to manually specify depedancies, so the
compiler can figure out what to recompile.

It would be an enormous step back.

> (Free )Pascal, OTOH, provides syntax for doing units with an "interface" 
> and provide using the "precompiled" interface definitions. Less flexible 
> but more structured and faster than the C way.

FPC also provides $I which is exactly the same as #include in C. 
 
> > so the whole unit concept of object
> > pascal has to be thrown away.
> That its why a "per unit base" could be more suitable and easier to do. 
> The C units would use C header files and a GNU compatible preprocessor. 
> A FP-propriety interface part would be added to the C units to make them 
> create an FP compatible compiled unit, usable in the normal way by 
> Pascal units and by the linker.

And no other C compiler would be compatible with it, voiding the only
positive aspect of C. Useless.

> (Still considering that on top of enabling FP to compile C sources 
> enabling the IDE including the debugger is an additional challenge.)

The IDE already includes a debugger. Lazarus just chose to not go that
route. It has nothing to do with C compilers.





More information about the Lazarus mailing list