-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfo_lexer.mll
More file actions
26 lines (24 loc) · 1.09 KB
/
fo_lexer.mll
File metadata and controls
26 lines (24 loc) · 1.09 KB
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
{
open Lexing
open Fo_parser
}
let blank = [' ' '\r' '\n' '\t']
let num = ['0'-'9']+
let alpha = ['a'-'z' 'A'-'Z']
let alphanums = ['a'-'z' 'A'-'Z' '0'-'9']*
rule token = parse
| blank { token lexbuf }
| "," { COM }
| "." { DOT }
| "(" { LPA }
| ")" { RPA }
| "=" { EQ }
| "NOT" { NEG }
| "AND" { CONJ }
| "OR" { DISJ }
| "EXISTS" { EXISTS }
| "FORALL" { FORALL }
| (alpha alphanums) as name { ID name }
| num as n { CST (int_of_string n) }
| eof { EOF }
| _ { failwith "unexpected character" }