[Lazarus] Parser

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Jul 1 13:07:53 CEST 2010


Marco van de Voort schrieb:

>> I am curious: Since compilers are your domain, allow me to ask: Do you 
>> think Borland did that (peppering code with '$externalsym xx ' stuff) 
>> because there was not other/better way? And, if you had a truly 
>> compatible C/C++ compiler, would you end up doing that too?
> 
> I fear so. The trouble is that I think that joining two so different
> languages (I mean as far as interfacing goes, e.g.  C's big reliance on
> preprocessing that is very freeform and has no automated equivalent) totally
> transparently is very, very difficult. Maybe even not possible.
> 
> Personally, I would invest more time in this before I went on a wild goose
> chase, and question why there are no quality automated translators already,
> after these languages have been side by side for 4 decades.

IMO we should separate C from C++ in this debate. C++ has a very 
different object model form the Delphi one, as have other languages as 
well (Java, Oberon et al. - which also use GC allover). That's why a 
restriction to only C will result in much simpler solutions, as I 
demonstrated in my ToPas converter. An only-C front-end for an Pascal 
compiler would be sufficient to me, allowing to use existing C library 
code immediately in Pascal programs.

The problem, that lead to the stall of the ToPas project, is the 
separation of the C #defines into true constants, functions and macros. 
When the user has to classify each of the #defines in e.g. Windows.h 
(about 900) himself, this makes the entire project unusable. But when 
instead the C code is preprocessed automatically, and fed directly into 
the tree generation of the compiler, such user decisions are no more 
required.

> The pie in the sky scenarios might turn out to be attractive on paper only
> e.g.  when only a very small subset of headers might be readily usable
> without heavily adding finely grained directives. 
> 
> Borland had a commercial C++ compiler, commercial Pascal compilers,
> knowledge in the company, and they didn't. I think they suspected that
> something fully automated would never be possible, and keeping it lowtech
> and transparents makes it doable for more users.

The BCB was a nice try, aimed at the C++ coder community, but Borland 
only could establish it as a serious MSC competitor, that forced 
Microsoft to upgrade their crappy MSC (and other) tool suites into the 
up-to-date MSVC development system. Since that time the development of 
the VCL and IDE was the only thing Borland could do, and its low market 
acceptance lead to the sale of that division, that ended up in Embarcadero.

DoDi





More information about the Lazarus mailing list