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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!npeer02.iad.highwinds-media.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada 2012 grammar References: <52694f8d$0$6630$9b4e6d93@newsspool2.arcor-online.net> Date: Fri, 25 Oct 2013 21:07:04 -0500 Message-ID: <85r4b8lr93.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) Cancel-Lock: sha1:36em71ItyNYfuFzETH04OlH8hHk= MIME-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 02a42526b23cfceb58b9907959 X-Received-Body-CRC: 4283589659 X-Received-Bytes: 2932 X-Original-Bytes: 3064 Xref: number.nntp.dca.giganews.com comp.lang.ada:183741 Date: 2013-10-25T21:07:04-05:00 List-Id: David Pereira writes: > Quinta-feira, 24 de Outubro de 2013 17:49:17 UTC+1, G.B. escreveu: >> On 24.10.13 17:01, David Pereira wrote: >> >> > Does anyone know if there is available a complete grammar for Ada >> > 2012, lets say, in Flex+Bison or similar compiler construction >> > tool-chain? >> >> The latest Emacs Ada Mode (5.00) has a Wisent style grammar >> >> for Ada 2012. "Copyright (C) 2012 Free Software Foundation, Inc." >> >> It could be usable after editing it a little. > > Dear G.B, > > Very nice hint! I am a Emacs user, but didn't occurred that to me > (shame on me :p). It is very new. Website: http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html The grammar there has conflicts, so it relies on a generalized LALR parser (http://en.wikipedia.org/wiki/Generalized_LR_parser), which I implemented in Emacs lisp. The grammar file can be parsed by a new OpenToken feature, and it will generate either Ada OpenToken source code, or Emacs lisp for a parser table; that version of OpenToken is available on the Ada mode website (not the OpenToken website http://stephe-leake.org/ada/opentoken.html). However, OpenToken only has a (non-generalized) LALR parser. It would be interesting to implement a generalized parser for Opentoken; let me know if you'd like to use that and/or help implement it. It might not be too hard to eliminate the conflicts so you can use the OpenToken parser (or some other parser); I did not do that because it seemed easier (not to say way more fun) to implement the parser :). In addition, the grammar source is closer to the Ada LRM Annex P this way. I've improved Ada mode a bit since the last post on the website; it's quite usable now. The latest is in monotone; see the Ada mode website for access info. It is time to post another release; maybe this weekend. Also note that I fixed several bugs in OpenToken, so if it was not working for you before, you should try it again. -- -- Stephe