[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Useless ambiguities in number specification, section 7.1.1

On Mon, Jan 21, 2013 at 6:27 AM, David A. Wheeler <dwheeler@x> wrote:
I wrote:
> > The syntactic specification for numbers in the Scheme R7RS draft 8
> > section 7.1.1 (lexical structure) has unnecessary useless ambiguities that
> > I think should be fixed.

Alex Shinn:
> Since once we get to the semantic interpretation of the
> numbers these two are the same, I don't think it matters.
> The formal syntax is primarily intended for human consumption,
> to clarify when the prose is not clear.  I'm not sure if any of the
> past versions had ever been fully parsable by a program.

It doesn't need to be directly executable, but
I think that it should be easy to implement the productions is a straightforward manner,
so that code can easily map to the specification.  In these cases, it's not hard
to tweak the specification to (1) have the same meaning but
(2) be easier to implement in an ambiguous way.

But Joe's EBNF preserves this ambiguity and parses fine.
And if you want to build a higher-level parser and not use
recursive descent, I'd imagine PEGs (which resolve this
ambiguity) would be a popular choice for Scheme.

Anyway, all things being equal it would probably be better to
remove the ambiguity, but you're making the EBNF (slightly)
longer, and thus harder for humans to read.  Since this still
doesn't get us a machine readable grammar it doesn't seem
worth changing the draft, though again I do encourage writing
a machine readable version.


Scheme-reports mailing list