[fpc-pascal] BNF grammar for fpc

Frank Peelo f26p at eircom.net
Fri Oct 16 15:24:22 CEST 2009


On 16/10/2009 10:53, Florian Klaempfl wrote:
> Marco van de Voort schrieb:
> 
>>In our previous episode, J�rgen Hestermann said:
>>
>>>>There is not even a proper open one for Delphi. At least there wasn't till a
>>>>while back.
>>>
>>>That may be because it is no longer possible to write a BNF grammar for 
>>>these compilers due to the c-style extensions.
>>
>>Odd that there are grammers for C and C++ then, and they have no problem :-)
>>Please don't grab any random other thread to make your point.
>>
>>The reason is probably more because Wirthian languages traditionally use
>>recursive descent parsers.
> 
> 
> gcc as well for several years simply because a recursive descent parser
> is faster than one generated automatically from a BNF grammar.

A while back, I read "Compiler Construction", by Prof. Wirth, now 
available for download:
http://www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf

It looks like recursive descent parsers and EBNF grammars go quite well 
together, so having a recursive descent parser should not be a bar to 
having a grammar.

Is the problem that you start off with a grammar, write the parser, then 
maintain the parser without updating the grammar?

Frank





More information about the fpc-pascal mailing list