You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
818 B

{ open Parser
module Helper = Complice.Lexer.Make ()
module M = Helper
}
let newline = ['\n' '\r']
let whitespace = [' ' '\t']
let var_id = ['a'-'z' 'A'-'Z']+
rule token = parse
| newline { M.new_line_met (); token lexbuf }
| whitespace { M.incr_offset 1; token lexbuf }
| "false" { M.incr_offset 5; BOOL false }
| "true" { M.incr_offset 4; BOOL true }
| "unit" { M.incr_offset 4; UNIT }
| "let" { M.incr_offset 3; LET }
| "fun" { M.incr_offset 3; FUN }
| "in" { M.incr_offset 2; IN }
| "->" { M.incr_offset 2; RARROW }
| "=" { M.incr_offset 1; EQ }
| var_id as id { M.incr_offset_string id; VARID id }
| eof { EOF }
| _ as c { M.incr_offset 1; M.unexpected_char c; EOF }