lexer.mll 927 Bytes
Newer Older
1
2
{
  open Parser
3
  exception Unexpected_char of string
4
5
}

Raphaël Cauderlier's avatar
Typos    
Raphaël Cauderlier committed
6
let id = [ 'a'-'z' ] ['a'-'z' 'A'-'Z' '_' '0'-'9']*
7

8
rule token = parse
Raphaël Cauderlier's avatar
Raphaël Cauderlier committed
9
    | [ ' ' '\t' ] { token lexbuf }
10
    | '\n' { token lexbuf }
11
12
    | '.'(id as s)"<=" { UPDATE (s) }
    | '.'(id as s) { SELECT (s) }
Raphaël Cauderlier's avatar
Typos    
Raphaël Cauderlier committed
13
    | '.'(id as s)":=" { FUPD(s) }
14
15
16
17
18
19
20
21
    | '[' { LBRACK }
    | ']' { RBRACK }
    | ':' { COLUMN }
    | ';' { SEMICOLUMN }
    | '(' { LPAR }
    | ')' { RPAR }
    | "ς" { SIGMA }
    | '=' { EQUAL }
Raphaël Cauderlier's avatar
Raphaël Cauderlier committed
22
    | "::=" { DEF }
23
24
25
26
    | '.' { DOT }
    | "->" { ARR }
    | "λ" { LAMBDA }
    | "type" { TYPE (Parsing.rhs_start_pos 1) }
27
    | "let" { VAR (Parsing.rhs_start_pos 1) }
28
29
    | "check" { CHECK (Parsing.rhs_start_pos 1) }
    | "norm" { NORM (Parsing.rhs_start_pos 1) }
30
    | id as s { ID (s) }
31
    | [ 'A'-'Z' ] ['a'-'z' 'A'-'Z' '_' '0'-'9']* as s { CID (s) }
32
    | _ as c { raise (Unexpected_char (Printf.sprintf"'%c'" c)) }
33
    | eof { raise End_of_file }