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,13b4e394fcd91d4 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.226.10 with SMTP id ro10mr830106pbc.6.1328146768465; Wed, 01 Feb 2012 17:39:28 -0800 (PST) MIME-Version: 1.0 Path: lh20ni250445pbb.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: OpenToken: Handling the empty word token Date: Wed, 1 Feb 2012 19:39:24 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <62121d9d-f208-4e78-a109-749742da14a6@h12g2000yqg.googlegroups.com> <1jvlv7i0tn14u.b5d2cwsqhl2h$.dlg@40tude.net> <82ehuibdwt.fsf@stephe-leake.org> <82obtkgj81.fsf@stephe-leake.org> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1328146767 14721 69.95.181.76 (2 Feb 2012 01:39:27 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 2 Feb 2012 01:39:27 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-02-01T19:39:24-06:00 List-Id: "Stephen Leake" wrote in message news:82obtkgj81.fsf@stephe-leake.org... > "Randy Brukardt" writes: > >> "Stephen Leake" wrote in message >> news:82ehuibdwt.fsf@stephe-leake.org... ... > I'm also on somewhat shakey ground on parser theory, but I did read (and > understand :) "the red dragon book" > (http://en.wikipedia.org/wiki/Principles_of_Compiler_Design), when I > took over OpenToken and fixed some major bugs. > > The parser is an LALR parser. > > But I think the implementation is not complete. There are no examples of > grammars containing epsilon in the OpenToken tests. I don't remember > what the dragon book has to say about epsilon handling. Well, you don't need to do anything special to handle "epsilon". Unless you actually want to write "epsilon", which is rather silly IMHO, as it represents nothing at all, and it is easier to write nothing at all. As I recall, the only problem I had with our generator was with an ambiguity in recognizing the ends of productions in the input; in our case that was solved by requiring an action number at the end even if no action was needed. An alternative way to handle that would be to change the input grammar to have "epsilon" stand for absoluty nothing (that might be easier if there are already some sort of reserved words in the grammar source). Randy.