Character escapes

Sat, 03 Feb 2007 10:21:42 -0800
draft, kawa

Use the standard \ to escape special characters, in both string literals, and outside. In general (outside string literals) a \ followed by a non-letter character makes that character be treated as a letter. E.g. \1\+2 is a 3-character identifiers consisting of the characters 1, +, and 2, even if the languages normally otherwise doesn't allow identifiers to start with digits or to contain +.

Letters don't need to be escaped, in either identifiers or names. So we're free to use \ followed by a letter for other purposes, including the standard C string escapes. I suggested at least the following:

\xNNNN - A Unicode escape. Terminated by the first character that is neither a digit or a letter. If that character is a space, it is ignored. Only a single space is ignored.

\n - A newline.

...

The string form of regular expressions should be compatible with this convention.