Article View: borland.public.delphi.documentation
Article #105Re: Object Pascal grammar (for LALR parser)
From: Hans-Peter Diettrich
Date: Fri, 01 Jun 2007 03:47
Date: Fri, 01 Jun 2007 03:47
31 lines
2138 bytes
2138 bytes
Andrej wrote: > I'm developing a parsing tool for for Delphi source files. > > As yet, I had no luck in finding the complete grammar for the language. Since nobody can be sure, when a grammar is complete, except by disassembling the compiler... > There is a "formal grammar" in Delphi 7 help, but it's has too many mistakes > and surely isn't the grammar supposed to build parsers! I just spent two > hours re-writing it to Backus-Naur form by hand - seems like it's not > "formal" at all... ;) Right, nobody ever specified the grammar of that so-called grammar. AFAIR the Delphi grammar was LL(1) until D2, nowadays it may be a bit higher. A complete and valid formal description of the current Delphi syntax IMO is impossible in a context free grammar, you may be better off by moving some details from the syntax into the semantics, or by using some kind of attributed grammar. > Thanks, For what? If you only need an parser, you better forget about a grammar, and use the parser of FreePascal instead. DoDi
Technical Details
Message-ID:
<465f96f8$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<465f53c9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10a202,7a4ae49aca5ba6e9 X-Google-Attributes: gid10a202,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 01 Jun 2007 05:47:47 +0200 From: Hans-Peter Diettrich <DrDiettrich1@aol.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13) Gecko/20060414 X-Accept-Language: en-us, en, de-de, de MIME-Version: 1.0 Newsgroups: borland.public.delphi.documentation Subject: Re: Object Pascal grammar (for LALR parser) References: <465f53c9@newsgroups.borland.com> In-Reply-To: <465f53c9@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 172.179.214.232 Message-ID: <465f96f8$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1180669688 172.179.214.232 (31 May 2007 20:48:08 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail