Escapes in strings

From Successor ML

Jump to: navigation, search

1. Introduction -- Nonescapable characters in the Definition are allowed, together with a most mild warning from the compiler, such as Notice.

2. Motivation and examples --- Novices sometimes have difficulty remembering which characters are escapable, such as "\a", and which are not, such as "\x", which in SMLofNJ results in two unclosed string syntax errors. Instead, treat this example as if "x" had been written and issue a mild warning not to do this. Novices will appreciate the gentleness and forgiving nature of the language/compiler and be able to move more quickly to 'debugging' their programs.

3. Assumptions --- None.

4. Formal syntax --- No change, but this is entirely a syntactic issue in that there is an implict translation from nonescapable characters as explained in section 2.

5. Formal static semantics --- Unless the translation and warning message generation are considered to be part of the static sematics of the compiler.

6. Formal dynamic semantics --- None.

7. Interactions with previous proposals and other language features --- None known.

8. Porting issues --- This effects no existing code.

9. Implementation issues --- Depending upon the organization of warning message generation in each compiler, this is either a matter solely of slightly revising the lexer or else making some changes in the static semantical part of the compiler. In either case, it appears to be quite readily accomplished.

Personal tools