Re: Grammar for optional elements

Tony Finch <dot@dotat.at>
20 Jun 2007 17:08:29 +0100 (BST)

          From comp.compilers

Related articles
[5 earlier articles]
Re: Grammar for optional elements 148f3wg02@sneakemail.com (Karsten Nyblad) (2007-06-17)
Re: Grammar for optional elements dot@dotat.at (Tony Finch) (2007-06-17)
Re: Grammar for optional elements torbenm@app-2.diku.dk (2007-06-18)
Re: Grammar for optional elements cfc@shell01.TheWorld.com (Chris F Clark) (2007-06-19)
Re: Grammar for optional elements dot@dotat.at (Tony Finch) (2007-06-19)
Re: Grammar for optional elements lowell@coasttocoastresearch.com (Lowell Thomas) (2007-06-19)
Re: Grammar for optional elements dot@dotat.at (Tony Finch) (2007-06-20)
Re: Grammar for optional elements Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2007-06-20)
Re: Grammar for optional elements cfc@shell01.TheWorld.com (Chris F Clark) (2007-06-21)
Re: Grammar for optional elements dot@dotat.at (Tony Finch) (2007-06-21)
Re: Grammar for optional elements lowell@coasttocoastresearch.com (Lowell Thomas) (2007-06-22)
Re: Grammar for optional elements cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-02)
| List of all articles for this month |
From: Tony Finch <dot@dotat.at>
Newsgroups: comp.compilers
Date: 20 Jun 2007 17:08:29 +0100 (BST)
Organization: dotat labs
References: 07-06-019 07-06-029 07-06-045
Keywords: parse
Posted-Date: 20 Jun 2007 20:38:45 EDT

"Lowell Thomas" <lowell@coasttocoastresearch.com> wrote:
>
>Parsing Expression Grammars are an interesting solution to the problem,
>but I don't think this one quite succeeds. In the term
>
>!(attr* attr1 attr*)
>
>it is my understanding is that the "*" operator is "greedy" and
>will always consume the entire remainder of the string,
>assuming all attributes are syntactically correct. Then
>the concatenation with attr1 will always fail (and hence the
>negative syntactic predicate will always succeed.)


Oops, yes you are right. The fix is similar to the one you gave in your
SABNF version, i.e. replace the attr in attr* expression with an
expression that doesn't match attr1: (!attr1 attr)


Tony.
--
f.a.n.finch <dot@dotat.at> http://dotat.at/


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.