Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make ml.lex and ml.grm more closely follow the Definition of SML
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