pieuvre/lexer.mll

50 lines
1.2 KiB
OCaml
Raw Permalink Normal View History

2024-04-09 11:09:33 +02:00
{
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*
2024-04-16 10:07:09 +02:00
let ty_id = uppercase uppercase* digit*
2024-04-09 11:09:33 +02:00
rule token = parse
2024-05-14 11:43:57 +02:00
| [' ' '\t' '\n'] { token lexbuf }
2024-04-30 11:44:28 +02:00
| '.' { DOT }
2024-05-16 12:31:06 +02:00
| ',' { COMMA }
2024-04-16 10:07:09 +02:00
| "False" { BOT }
2024-04-09 11:09:33 +02:00
| '(' { LPAREN }
| ')' { RPAREN }
2024-04-09 11:30:52 +02:00
| "fun" { FUN }
2024-04-09 11:09:33 +02:00
| ':' { COLON }
| "=>" { ARR }
2024-04-16 10:07:09 +02:00
| "->" { TARR }
| '~' { TILDE }
2024-04-09 11:09:33 +02:00
| "exf" { EXFALSO }
2024-05-05 20:33:39 +02:00
| "/\\" { AND }
| "\\/" { OR }
2024-05-16 12:31:06 +02:00
| "l" { L }
| "r" { R }
2024-04-30 11:44:28 +02:00
| "Goal" { GOAL }
2024-05-11 11:44:43 +02:00
| "Undo" { UNDO }
2024-05-13 18:05:28 +02:00
| "Qed" { QED }
| "Check" { CHECK }
2024-04-30 11:44:28 +02:00
| "exact" { EXACT }
| "assumption" { ASSUMPTION }
2024-05-01 10:44:36 +02:00
| "intros" { INTROS }
2024-04-30 11:44:28 +02:00
| "intro" { INTRO }
| "cut" { CUT }
| "apply" { APPLY }
2024-05-05 20:45:55 +02:00
| "left" { LEFT }
| "right" { RIGHT }
2024-05-06 10:09:40 +02:00
| "split" { SPLIT }
| "try" { TRY }
2024-04-30 11:44:28 +02:00
2024-04-09 11:09:33 +02:00
| var_id as s { VARID(s) }
| ty_id as s { TYID(s) }
2024-05-14 11:43:57 +02:00
| eof { EOF }