Lexical analysis.
The functions for lexical analysis in the original code where in the Intro module and have been moved here for isolation purposes.
Function or value | Description |
Full Usage:
alphanumeric s
Parameters:
string
-
The single character string to be classified.
Returns: bool
true if the single character string it is considered
alphanumeric, otherwise false.
|
Example
Evaluates to true .
Example
Evaluates to true .
Example
Evaluates to false .
|
Full Usage:
lex inp
Parameters:
string list
-
The input list of single character strings to be tokenized.
Returns: string list
The input list of single character strings tokenized.
|
It maps a list of input characters
Example
Evaluates to ["("; "("; "11"; "+"; "2"; ")"; "*"; "x_1"; ")"] .
Note how 11 and x_1 are analyzed as a single tokens.
|
Full Usage:
lexwhile prop inp
Parameters:
string -> bool
-
The predicate to identify tokens.
inp : string list
-
The input list of single character strings.
Returns: string * string list
A pair with the longest initial sequence of elements of
inp classifiable as satisfying prop as the first
component, and the remaining characters as the second.
|
![]() ![]() ![]() ![]() ![]() ![]()
Takes a property
Example
Evaluates to ("((", ["1"; " "; "+"; " "; "2"; ")"; " "; "*"; " "; "x"; "_"; "1"; ")"]) .
|
Full Usage:
matches s
Parameters:
string
-
The string of all characters to be matched.
Returns: string -> bool
A function that applied to a single character string checks
if it matches the given pattern.
|
Example
Evaluates to true .
Example
Evaluates to false .
|
Full Usage:
numeric s
Parameters:
string
-
The single character string to be classified.
Returns: bool
true if the single character string it is considered
numeric, otherwise false.
|
|
Full Usage:
punctuation s
Parameters:
string
-
The single character string to be classified.
Returns: bool
true if the single character string it is considered a
punctuation symbol, otherwise false.
|
Example
Evaluates to true .
Example
Evaluates to false .
|
Full Usage:
space s
Parameters:
string
-
The single character string to be classified.
Returns: bool
true if the single character string it is considered a space,
otherwise false.
|
Tabs and new lines are also considered spaces.
Example
Evaluates to true .
Example
Evaluates to false .
|
Full Usage:
symbolic s
Parameters:
string
-
The single character string to be classified.
Returns: bool
true if the single character string it is considered symbolic,
otherwise false.
|
Example
Evaluates to true .
Example
Evaluates to false .
|