Source

lambda-translator / lexer.mll

Full commit
yoshihiro503 3416b61 
yoshihiro503 2c925c6 

yoshihiro503 3416b61 








yoshihiro503 2c925c6 




yoshihiro503 3416b61 

yoshihiro503 2c925c6 
yoshihiro503 3416b61 
{
  type token = Lambda | Dot | Ident of string | Open | Close
| Int of int | EOL
  exception Eof
}

let digit = ['0'-'9']
let alpha = ['A'-'Z' 'a'-'z' '_']

rule token = parse
  [' ' '\t']     { token lexbuf }     (* skip blanks *)
| ['\n' ]        { EOL }
| "lambda"       { Lambda }
| '\\'           { Lambda }
| '.'            { Dot }
| '('            { Open }
| ')'            { Close }
| alpha (digit|alpha)*
    { Ident (Lexing.lexeme lexbuf) }
| ['0'-'9']+     { Int (int_of_string(Lexing.lexeme lexbuf)) }
| eof            { raise Eof }