Re: Delphi formal grammar?

Barry Kelly <barry.j.kelly@gmail.com>
19 Aug 2006 10:35:18 -0400

          From comp.compilers

Related articles
Delphi formal grammar? kossey@cablenet.de (VergissMeinNicht) (2006-08-19)
Re: Delphi formal grammar? barry.j.kelly@gmail.com (Barry Kelly) (2006-08-19)
Re: Delphi formal grammar? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-08-19)
Re: Delphi formal grammar? luca.masini@ieee.org (Luca Masini) (2006-08-19)
Re: Delphi formal grammar? marcov@stack.nl (Marco van de Voort) (2006-08-20)
Re: Delphi formal grammar? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-08-20)
Re: Delphi formal grammar? JoachimPimiskern@web.de (Joachim Pimiskern) (2006-08-22)
| List of all articles for this month |
From: Barry Kelly <barry.j.kelly@gmail.com>
Newsgroups: comp.compilers
Date: 19 Aug 2006 10:35:18 -0400
Organization: Compilers Central
References: 06-08-119
Keywords: Basic, parse
Posted-Date: 19 Aug 2006 10:35:18 EDT

VergissMeinNicht wrote:


> The Delphi Help's formal grammar does not have some non-terminal
> definitions for example
>
> ConstExpr


Yes, you can't (easily) parse ConstExprs using LL(1) without type
information. Specifically, structured constants are somewhat awkward
to distinguish from parenthesized expressions:


    var
        x: Integer = (Foo + Bar);
        y: TRecord = (Foo : Bar);
        z: TArray = (Foo , Bar);


> AssemblyLanguage


Basically, all the tokens between 'asm' and 'end' get sent off to the
assembler.


> Where can I found a "working" grammar?


I can't help you with that, sorry. To get a quality parse for Delphi,
I expect you'll either need a relatively powerful parser generator or
a fair amount of ad-hockery and symbol table info in a manually
written parser.


-- Barry


--
http://barrkel.blogspot.com/


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.