Re: [fpc-pascal] BNF grammar for fpc
> 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. -- View this message in context: http://www.nabble.com/BNF-grammar-for-fpc-tp25914637p25952532.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
Marc Santhoff wrote: Am 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? ... 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 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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
Am 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? > > 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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
Am Donnerstag, den 15.10.2009, 23:58 -0700 schrieb leledumbo: > > 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 Okay, nothing to play with without huge effort. ;) Thank you, Marc -- Marc Santhoff ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
On Fri, Oct 16, 2009 at 4:58 AM, leledumbo wrote: > 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 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, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
mar...@stack.nl: > 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 effort at all. Vinzent. -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
Florian Klaempfl schrieb: > Frank Peelo schrieb: >> 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 Very early ... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
Frank Peelo schrieb: > > 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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
In our previous episode, Florian Klaempfl said: > >> 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. 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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
On Thu, Oct 15, 2009 at 9:28 PM, Marc Santhoff wrote: > is 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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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. That is true, but the _expression_ power is not as good as a BNF grammar. There are some language constructs that is simply not posible with a LL(1) parser, when comparing to the LALR(1). I don't have the details with me right now, but have a decent book on compiler construction at home. Kind regards, - Torsten Bonde Christiansen. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
On 16 Oct 2009, at 10:42, Jürgen Hestermann wrote: That 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___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
In our previous episode, leledumbo said: > > > 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 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. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BNF grammar for fpc
> 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 -- View this message in context: http://www.nabble.com/BNF-grammar-for-fpc-tp25914637p25920664.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal