[R6RS] Making -> a valid identifier

dyb at cs.indiana.edu dyb at cs.indiana.edu
Fri May 12 12:59:31 EDT 2006


> <peculiar identifier> -> + | - | ... | <strange identifier>
> <strange initial> -> - | . | +
> <strange identifier> -> <strange initial> <subsequent>*
>   ... but excluding everything in <number>

This allows a single . as an identifer:

  <peculiar identifier> => <strange identifier>
                        => <strange initial> <subsequent*>
                        => . <subsequent*>
                        => .

and it can generate + and - in two different ways, e.g.:

  <peculiar identifier> => +

and

  <peculiar identifier> => <strange identifier>
                        => <strange initial> <subsequent*>
                        => + <subsequent*>
                        => +

Perhaps the following would do what you intended:

<peculiar identifier> -> + <subsequent>* | - <subsequent>* | . <subsequent>+
excluding everything in <number>

Unfortunately, either grammar can generate confusing "faux numbers" like

  +.25e16 at 21i

so this doesn't seem to have any advantages over the more general solution
of making +, -, ., and <digit> valid initials while "excluding . and
everything in <number>".

> <strange identifier> -> <strange initial> <strange subsequent> <subsequent>*
> <strange subsequent> -> <constituent, without i and n> 
> 	              | <special initial>
>                       | <special subsequent>
> <constituent> -> <what SRFI 75 says replaces <letter> > 

This allows some numbers, like +.1, to be parsed as identifiers:

  <strange identifier> => <strange initial> <strange subsequent> <subsequent>*
                       => + <strange subsequent> <subsequent>*
                       => + <special subsequent> <subsequent>*
                       => + . <subsequent>*
                       => + . 1

and of course also admits some faux numbers.

The simplest approach to adding symbols that start with -> would be the
one you suggested a long time ago:

  <peculiar identifier> -> + | - | ... | -> <subsequent>*

This is "piling feature on top of feature", but anything else short of an
"excluding <number>" solution will likely further complicate the identifier
grammar and still feel like piling feature on top of feature.

On the other hand, the most general "excluding number" solution would
eliminate the weakness that is causing us to consider piling this new
feature on.  Of course, we'd have to weigh that benefit against the
potential backward compatibility problem that Marc brought up a while
back, which is that a future extension to the syntax of numbers may result
in a contraction of the set of standard identifiers.

Kent



More information about the R6RS mailing list