This repository has been archived on 2022-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
compilateurMIPS/lexer.mll
2022-12-06 20:39:15 +01:00

15 lines
304 B
OCaml

{
open Lexing
open Parser
exception Error of char
}
let num = ['0'-'9']
rule token = parse
| eof { Lend }
| [ ' ' '\t' ] { token lexbuf }
| '\n' { Lexing.new_line lexbuf; token lexbuf }
| num+ as n { Lint (int_of_string n) }
| _ as c { raise (Error c) }