From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c89a4b067758a6e1 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!uio.no!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Date: Wed, 20 Feb 2008 07:53:19 +0200 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is it really Ok to assert that the Ada syntax is a context-free grammar ? References: <4a448c5c-a4ed-446f-bb8b-67c5ba99927a@f47g2000hsd.googlegroups.com> In-Reply-To: <4a448c5c-a4ed-446f-bb8b-67c5ba99927a@f47g2000hsd.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <47bbbc3c$0$21896$4f793bc4@news.tdc.fi> Organization: TDC Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1203485756 news.tdc.fi 21896 81.17.205.61:32801 X-Complaints-To: abuse@tdcnet.fi Xref: g2news1.google.com comp.lang.ada:19904 Date: 2008-02-20T07:53:19+02:00 List-Id: Hibou57 wrote: > Hi peoples living here :p > > I got a doubt about [ARM 1.1.4-1] > >> The form of an Ada program is described by means of a >> context-free syntax together with context-dependent >> requirements expressed by narrative rules. > > But as pointed by someone, the grammar is not LR(1), due to the fact > (which is common to many other languages), that as an exemple X(Y) can > stand for a type cast, a function call, an array access, or even an > array slice, and this cannot be decided without knowlegde of the > context. So? I believe several programming languages are defined by context-free grammars that are ambiguous unless such "static semantics" is used to guide the parsing. Trying to express all language rules in the grammar leads either to wild proliferation of punctuation symbols (as in some Basics or Perl) or to a context-dependent grammar (as in the Algol 68 two-level grammar). > Am I wrong or is there really a so big mistake in the ARM ? The ARM doesn't say that the grammar is LR(1), only that it is context-free, and that is true. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .