SML# Document Version 4.0.0
17 Lexical structure

17.1 Character set

Characters usable in the SML# language are extended ASCII characters from 0 to 255 (in decimal). Key words and delimiters are among the characters from 0 through 127. Identifiers may ASCII characters from 0 to 255, including 8-bit characters from 128 to 255, as far as they are not overlap with keywords and delimiters. This rule allows the programmer to use UTF8 encoded Japanese (and other) character string as identifiers. The following interactive session show example codes with Japanese identifiers.

$ smlsharp
SML# 4.0.0 ...
# datatype メンバー =
>    研究員 of {氏名:string, 年齢:int, 学位:string}
> | 職員 of {氏名:string, 年齢:int};
datatype メンバー =
    研究員 of {学位:string, 年齢:int, 氏名:string}
  | 職員 of {年齢:int, 氏名:string}
# 研究員 {学位="Ph.D.", 年齢=21, 氏名="大堀"};
val it =
  研究員 {学位 = "Ph.D.",年齢 = 21,氏名 = "大堀"} : メンバー