Hi everyone,
is a complete grammar for fpc written in some variant of BNF available somewhere?
I searched the website and the wiki, to no avail.
TIA,
Marc

Mailing lists / fpc-pascal / 2009-10
21 messages · 14 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi everyone,
is a complete grammar for fpc written in some variant of BNF available somewhere?
I searched the website and the wiki, to no avail.
TIA,
Marc
is a complete grammar for fpc written in some variant of BNF available somewhere? I searched the website and the wiki, to no avail.
AFAIK, there's none. The developers adding language features by directly modifying the code. Even there's a bounty for it. See: http://wiki.lazarus.freepascal.org/Bounties#FPC_grammar
In our previous episode, leledumbo said:
There is not even a proper open one for Delphi. At least there wasn't till a while back.
IIRC there was a discussion about this in comp.lang.pascal.delphi.misc somewhere in the summer, and some new sources were mentioned. Have a look.
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.
Jürgen Hestermann wroteThat may be because it is no longer possible to write a BNF grammar for these compilers due to the c-style extensions.
BNF grammars exist for C (e.g. as part of the ANSI C standard) and even for C++. Please don't start a language war in every single thread.
Jonas
That may be because it is no longer possible to write a BNF grammar for these compilers…
In our previous episode, J�rgen Hestermann said:
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.
From: Marco van de Voort (...) The reason is probably more because Wirthian languages traditionally use recursive descent parsers.
This reminds me: there are a compiler generator named COCO/R wich has a Pascal version (Delphi actually). It generates recursive descendent parsers. ( search results ->
www.google.com/search?hl=es&q=%22COCO%2FR%22&btnG=Buscar&lr=).
Greetings.
gcc as well for several years simply because a recursive descent parser is faster than…
is a complete grammar for fpc written in some variant of BNF available somewhere? I…
Marc Santhoff wroteis a complete grammar for fpc written in some variant of BNF available somewhere?
Gold parser builder has a BNF grammar for Delphi 7 (AFAIK, incomplete):
http://www.devincook.com/goldparser/grammars/index.htm
Regards,
Gerard.
gcc as well for several years simply because a recursive descent parser is faster than…
In our previous episode, Florian Klaempfl said:
Afaik most C/C++ production compilers are nowadays, gcc was about the last. It doesn't preclude BNF grammars from existing though, which was the point.
On Pascal, not even the startup compilers are parser generator (grammar) based.
gcc as well for several years simply because a recursive descent parser is faster than…
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
Is the problem that you start off with a grammar, write the parser, then maintain the parser without updating the grammar?
Every early FPC (FPK Pascal) prototypes in 1993 used yacc as well but it was simply too slow and also memory consuming at these days.
Very early ...
In our previous episode, J�rgen Hestermann said: Odd that there are grammers for C and…
The reason is probably more because Wirthian languages traditionally use recursive descent parsers.
Yeah, right.
The reason is most definitely that of all those people who know the language well enough to write the grammar, there's no one actually doing it.
Of course, with all those new features and Delphi-compatibility switches, the language probably probably changes too often to be worth the Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
AFAIK, there's none. The developers adding language features by directly modifying the…
leledumbo wroteAFAIK, there's none. The developers adding language features by directly modifying the code. Even there's a bounty for it. See: http://wiki.lazarus.freepascal.org/Bounties#FPC_grammar
I contacted the person that posted the bounty but he didn't answer.
If anyone still wants a grammar I'm interrested in writing for a fair price.
thanks,
AFAIK, there's none. The developers adding language features by directly modifying the…
Okay, nothing to play with without huge effort. ;)
Thank you,
Marc
is a complete grammar for fpc written in some variant of BNF available somewhere? I…
2009/10/15 Marc Santhoff :
is a complete grammar for fpc written in some variant of BNF available somewhere?
About 2 weeks ago, I had no clue what BNF was. Funny that you mention it, because I am working on a LaTeX converter to IPF. I was google'ing for a BNF for LaTeX, as a starting point.
Anyway, I found the following like to a BNF Compiler that supports 5+ languages. http://code.haskell.org/bnfc/
Maybe this can be extended to Object Pascal - time permitting obviously.
There are too many compiler generation tools to know them all.
we all know:
- lex and yacc
- flex and bison
and the pascal generating mutant
more recent:
- antlr (former pccts)
- eli and DEViL
- JavaCC
- Jaccie and SIC
older things like twig, burg and the like
- Coco/R was named already
- Gold Parsing System was totally new to me
and so on.
If you have fun fiddling with those tools some good starting points are:
http://catalog.compilertools.net/
http://www.compilers.net/
http://www.thefreecountry.com/
http://cui.unige.ch/db-research/Enseignement/analyseinfo/BNFweb.html
Have a nice weekend,
Marc
Marc Santhoff wroteAm Freitag, den 16.10.2009, 22:50 +0200 schrieb Graeme Geldenhuys: > 2009/10/15 Marc Santhoff : >> is a complete grammar for fpc written in some variant of BNF available >> somewhere?
...
The following page is about Delphi 5 :
http://www.felix-colibri.com/papers/compilers/delphi_5_grammar/delphi_5_grammar.html
Thank you very much
Mehmet Erol Sanliturk
That may be because it is no longer possible to write a BNF grammar for these compilers due to the c-style extensions.
AFAIK if a parser can be made for an extension, so is the grammar.
There are some language constructs that is simply not posible with a LL(1) parser, when comparing to the LALR(1).
For example, left recursion. Yes, I know LALR(1) can recognize this. But it can be solved easily by transforming the grammar such that the recursion is eliminated and LL(1) wins again.