forked from codeon/cmlex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax.sml
40 lines (35 loc) · 1012 Bytes
/
syntax.sml
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
structure Syntax =
struct
datatype charset =
Svar of string
| Ssymbol of Automata.symbol
| Srange of (Automata.symbol * Automata.symbol) list
| Sempty
| Sunion of charset list
| Sintersection of charset list
| Sdifference of charset * charset list
| Scomplement of charset list
| Sany
datatype regexp =
Var of string
| Symbol of Automata.symbol
| String of Automata.symbol list
| Any
| Epsilon
| Empty
| Concat of regexp list
| Union of regexp list
| Optional of regexp
| Closure of regexp
| Plus of regexp
| Exactly of regexp * int
| AtLeast of regexp * int
| Repeat of regexp * int * int
| Eos
datatype directive =
Option of string * string
| Alphabet of int
| Function of string * string * (regexp * string) list
| Regexp of string * regexp
| Set of string * charset
end