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

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



Hi,

On Sat, Jan 19, 2013 at 2:25 AM, David A. Wheeler <dwheeler@x> 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.

For one thing, there is a useless ambiguity in the prefix_10 production
(for base 10 numbers) when both "exactness" and "radix_10" are empty.
Currently the exactness and radix_10 productions accept "empty",
but the "prefix_10" production is defined as:
  prefix_10 ->  radix_10 exactness | exactness radix_10
That means a number with empty radix_10 and empty exactness has a
useless ambiguity. For example, given "7", is its prefix
no-radix no-exactness, or no-exactness no-radix?

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.
There does seem to be interest in a machine-parsable definition
and you might want to work together with Joseph Wayne Norton
on this.  You could also try looking for Scheme implementations
which use formal lexers.  I believe most write their own recursive
descent parsers, but there must be some that use flex or similar.

We can save the machine parsable format(s) in the repository
and possibly link to it in the appendix.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports