pieuvre/lexer.mll
2024-05-16 12:31:06 +02:00

52 lines
1.3 KiB
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' '\n'] { token lexbuf }
| '.' { DOT }
| ',' { COMMA }
| '+' { PLUS }
| '*' { TIMES }
| "True" { TOP }
| "False" { BOT }
| '(' { LPAREN }
| ')' { RPAREN }
| "fun" { FUN }
| ':' { COLON }
| "=>" { ARR }
| "->" { TARR }
| '~' { TILDE }
| "exf" { EXFALSO }
| "/\\" { AND }
| "\\/" { OR }
| "l" { L }
| "r" { R }
| "Goal" { GOAL }
| "Undo" { UNDO }
| "Qed" { QED }
| "exact" { EXACT }
| "assumption" { ASSUMPTION }
| "destruct" { DESTRUCT }
| "intros" { INTROS }
| "intro" { INTRO }
| "cut" { CUT }
| "apply" { APPLY }
| "left" { LEFT }
| "right" { RIGHT }
| "split" { SPLIT }
| var_id as s { VARID(s) }
| ty_id as s { TYID(s) }
| eof { EOF }