File: new_letter.doc

package info (click to toggle)
hol88 2.02.19940316dfsg-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 65,816 kB
  • sloc: ml: 199,939; ansic: 9,666; sh: 6,913; makefile: 6,032; lisp: 2,747; yacc: 894; sed: 201; cpp: 87; awk: 5
file content (40 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
\DOC new_letter

\TYPE {new_letter : (string -> void)}

\SYNOPSIS
Defines a character to be a letter.

\DESCRIBE
When given a string, which should be of length 1, {new_letter} extends
the scope of the definition of `letter' as used by {is_letter}.
(If the supplied string is null ({``}) {new_letter} has no effect.)

The definition of a `letter' by default includes (only)
{a..z A..Z}. A call to {new_letter} can affect ML lexical analysis dynamically,
because the function {is_letter} is called by the lexical analyzer to check for
the start of an identifier.

\EXAMPLE
In the default state, {-1} is parsed as the application of {-} to {1}:
{
   #let x = -1 ;;
   x = -1 : int
}
\noindent but if we make {-} into a letter:
{
   #new_letter(`-`);;
   () : void
}
\noindent then {-1} parses as an (undefined) identifier.
{
   #let x = -1;;
   unbound or non-assignable variable -1
}
\FAILURE
Fails if the string has length greater than 1.

\SEEALSO
ascii, ascii_code, is_alphanum, is_letter, new_alphanum.

\ENDDOC