42 lines
1008 B
OCaml
42 lines
1008 B
OCaml
{
|
|
open Parser
|
|
exception Eof
|
|
}
|
|
|
|
let lowercase = ['a'-'z']
|
|
let uppercase = ['A'-'Z']
|
|
let digit = ['0'-'9']
|
|
let word = (lowercase | uppercase)*
|
|
|
|
let var_id = lowercase lowercase* digit*
|
|
let ty_id = uppercase uppercase* digit*
|
|
|
|
rule token = parse
|
|
| [' ' '\t'] { token lexbuf }
|
|
| '\n' { EOL }
|
|
| '.' { DOT }
|
|
| '+' { PLUS }
|
|
| '*' { TIMES }
|
|
| "True" { TOP }
|
|
| "False" { BOT }
|
|
| '(' { LPAREN }
|
|
| ')' { RPAREN }
|
|
| "fun" { FUN }
|
|
| ':' { COLON }
|
|
| "=>" { ARR }
|
|
| "->" { TARR }
|
|
| '~' { TILDE }
|
|
| "exf" { EXFALSO }
|
|
|
|
| "Goal" { GOAL }
|
|
| "exact" { EXACT }
|
|
| "assumption" { ASSUMPTION }
|
|
| "intros" { INTROS }
|
|
| "intro" { INTRO }
|
|
| "cut" { CUT }
|
|
| "apply" { APPLY }
|
|
|
|
| var_id as s { VARID(s) }
|
|
| ty_id as s { TYID(s) }
|
|
| eof { raise Eof }
|