Skip to content

Commit

Permalink
Make ml.lex and ml.grm more closely follow the Definition of SML
Browse files Browse the repository at this point in the history
The lexer now properly distinguishes between alphanumeric and symbolic
and short and long identifiers.  The parser uses the fine-grained
identifier classes to properly define vid, longvid, tycon, longtycon,
field, strid, longstrid, sigid, and fctid classes.

This fixes a minor bug where MLton erroneously accepted symbolic
identifiers for strid, sigid, and fctid and erroneously accepted
symbolic identifiers before "." in long identifiers.

This also further extends the treatment of `=` as a special identifier
by allowing including `=` in the vid class and equating the con class
with the vid class.  Thus, the program:

    datatype t = = of unit

does not give a parse error, but does give a "Special identifier
cannot be redefined by datata: =." error.

This almost allows `=` everywhere a vid is allowed.  The exception is
that a vidNoEquals class is used (as was previously) in atomic
patterns.  The issue is with

   val pat = exp

and

   fun f apat apat ... apat = exp

phrases, where an `=` in the pattern is difficult to distinguish from
the `=` terminating the pattern(s).

It would be possible to have a set of *NoEqual pattern productions
that excluded the `=` vid, which would be used for these patterns
appearing in declarations.
  • Loading branch information
MatthewFluet committed Jun 2, 2017
1 parent 236592b commit 9a56be6
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 133 deletions.

0 comments on commit 9a56be6

Please sign in to comment.