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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada 2012 grammar Date: Thu, 24 Oct 2013 22:19:28 +0200 Organization: cbb software GmbH Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: GYYt8Fzv3ax+aWVyAAu7jw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 1632 Xref: number.nntp.dca.giganews.com comp.lang.ada:183720 Date: 2013-10-24T22:19:28+02:00 List-Id: On Thu, 24 Oct 2013 08:01:13 -0700 (PDT), David Pereira wrote: > I would like to extend it to some new contract constructs, but writing a > complete parser is a huge (and extremely time-consuming) task that I would > like to avoid :). Difficult for parsing are only expressions. The language itself is very simple to parse using recursive descent parser, e.g. to generate an AST. To write a table-driven parse would be one-day work or so. Ada expressions parser can be found here: http://www.dmitry-kazakov.de/ada/components.htm#12.9 However it is Ada 95. The difference AFAIK to Ada 2005 is reserved words like "interface" to filter out from identifiers. To Ada 2012 it is conditional expressions. Not difficult to add. I would not bother either with grammars. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de