[fpc-devel] Coco/R usage for FPC

Florian Klaempfl florian at freepascal.org
Tue Jan 26 10:56:35 CET 2010

Graeme Geldenhuys schrieb:
> Hi,
> Speaking of language syntax in another thread it got me thinking.
> Being around FPC for a few years now I have read many messages and saw
> patches regarding language extensions etc...
> Then today by pure accident while searching for Modula-2 if..then..end
> syntax I came across this page:
>   http://www.scifac.ru.ac.za/coco/
> Coco/R ( a compiler generator). A language syntax is described in a
> rather simple manner. You then feed this information into a program
> and it generates a parser and scanner.  The above URL mentions
> versions available for Modula-2, Pascal, Delphi and many more...
> Students from the Rhodes University used Coco/R to create a new
> teaching language based on Modula-2. They called in Umbriel, and used
> Coco/R.
>   http://scifac.ru.ac.za/cspt/sigplan.htm
> I gather FPC doesn't use something like this?  If so, any specific
> reason why not? 

I don't know how the situation is currently, but at the time basic FPC
was written, compiler generators generated slow code (and wasted
memory), error recovery was hard, one dependend on an external tool with
all it disadvantages, running the compiler generator was an extra step
(remember, I did the initial development of FPC on a 386-40 with 4 MB
memory on DOS), debugging a yacc generated parser being table driven is
a pain etc.

Today this might have changed but considering that gcc uses now a
handcoded frontend as well, I don't believe in this.

> It seems like a very easy way to extend the language
> though. 

Extending the language is usually simple, maintaining it is really hard.
Just look at the generics, we're still fighting with its pitfalls.

More information about the fpc-devel mailing list