This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
compilation/tp/tp-reduce-reduce/functions-multiple-arguments/lexer.mll
2023-10-23 16:00:15 +02:00

21 lines
537 B
OCaml

{ (* Emacs, open this file with -*- tuareg -*- *)
open Parser
}
let layout = ' ' | '\t' | '\n'
let number = ['0'-'9']+
let identifier = ['a'-'z']['A'-'Z' '0'-'9' 'a'-'z' '_']*
rule token = parse
| eof { EOF }
| layout { token lexbuf }
| number as i { INT (int_of_string i) }
| "fun" { FUN }
| identifier as s { ID s }
| "(" { LP }
| ")" { RP }
| "->" { RIGHT_ARROW }
| "+" { PLUS }
| _ as c {
failwith (Printf.sprintf "Invalid character: %c\n" c)
}