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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4fd338e56f592cfb X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 X-Received: by 10.66.159.103 with SMTP id xb7mr5634166pab.25.1367665493467; Sat, 04 May 2013 04:04:53 -0700 (PDT) Path: bp1ni1517pbd.1!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.etla.org!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: LALR parser question Date: Tue, 30 Apr 2013 03:19:26 +0200 Organization: Ada @ Home Message-ID: References: <85sj2aydwi.fsf@stephe-leake.org> NNTP-Posting-Host: ZXqOjp+NNxswgqXUj66j5g.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Received-Bytes: 2776 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2013-04-30T03:19:26+02:00 List-Id: Le Sun, 28 Apr 2013 16:43:06 +0200, Dmitry A. Kazakov = a =C3=A9crit: > On Sun, 28 Apr 2013 08:37:33 -0500, Stephen Leake wrote: > >> Any other ways to handle this problem? > > Recursive decent parser. Or return to the original ascent parser: http://en.wikipedia.org/wiki/LALR_parser > In 1965, Donald Knuth invented the LR parser (Left to Right, > Rightmost derivation). The LR parser can recognize any > deterministic context-free language in linear-bounded time. > However, rightmost derivation has very large memory requirements > and implementing an LR parser was impractical due to the limited > memory of computers at that time. To address this shortcoming, in > 1969, Frank DeRemer proposed two simplified versions of the LR > parser, namely the Look-Ahead LR (LALR) And above in the introduction, commenting about LALR: > The simplification that takes place results in a parser with > significantly reduced memory requirements but decreased language > recognition power. This suggest LALR is limited by design and the original LR was less = limited. I did a top=E2=80=91down (decent) parser some many years ago, and was no= t that = much happy with neither. Either ascent, decent, left=E2=80=91right or ri= ght=E2=80=91left, = they all requires to torture the grammar to make the parser generator = happy. Note: GNAT uses a hand=E2=80=91written parser (I'm pretty sure to rememb= er I've = seen it somewhere). -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity