[Mono-devel-list] Pascal compiler?

Willibald Krenn Willibald.Krenn at gmx.at
Sun Mar 13 14:32:21 EST 2005


> I would be quite willing to work on such a project (in my spare time), 

Excellent!

> but I don't have the documentation to do a decent job of it.  It seems 
> to me that the best bet would be to match the language used by Borland's 
> products for maximum compatibility.

Yes, of course - this goes without saying..


> The latest version of Delphi that I have documentation for is ver6 and I 
> don't have the cash to go out and buy ver8.  (Remember when Turbo Pascal 
>  3.0 cost $49?)

Well, I too have D6 on my Windows partition (plus Kylix 3 for Linux). 
Note that a recursive descend parser for D4-5 (partly 6) syntax is not 
that hard:  http://sourceforge.net/projects/arkadios (A project of mine 
currently in sleeping mode)
The parser is based on Martin Waldenburg's Delphi parser but translated 
to C. However, the generics part on top is not worth to be kept, as it's 
dog slow and pre-pre beta. BTW: IIRC I did not translate the Lexer to C, 
but this should not be a problem.

Finally, translating the above source from C to C# should not be a 
problem at all.

> If someone can provide a language spec, I would be willing to begin 
> putting together a scanner/parser.
> 
> Shouldn't something like this be able to leverage the gmcs compiler 
> internals for the IR and such?

We have four possiblities as I see it:
  1.> Implement from scratch with some compiler generator
  2.> Implement from scratch (based on the recursive descend parser from 
above)
  3.> Fork from Free Pascal Compiler
  4.> Take (g)mcs and make it understand Delphi

3.> has the nice benefit of the compiler being self-hosted (?) - I mean 
the source of the compiler itself would be in Pascal and a good unit 
test. Drawback: We need a Delphi.NET command line compiler for 
bootstrapping during the first time (Perhaps there's some free community 
version?) and we'll have to introduce significant modifications to the 
FPC code base.

4.> Maybe some of the (g)mcs developers can help us out here, explaining 
what would have to be done? But due to the differences between C# and 
Delphi chances are good that we have to modify the used IR.

BTW: Theoretically we could even mix languages ;-)

I guess we agree on a managed implementation..

Willi




More information about the Mono-devel-list mailing list