view lab0/lexer.mll @ 4:9f5c8e19f204 tip basis

Oops: fix for lab0
author Mike Spivey <mike@cs.ox.ac.uk>
date Mon, 15 Oct 2018 21:58:03 +0100
parents 9176d9aa3163
children
line wrap: on
line source
(* lab1/lexer.mll *)
(* Copyright (c) 2017 J. M. Spivey *)

{
open Parser 
open Lexing
}

rule token = 
  parse
      ['A'-'Z''a'-'z']['A'-'Z''a'-'z''0'-'9''_']* as s
                        { IDENT s }
    | ['0'-'9']+("."['0'-'9']+)? as s
                        { NUMBER (float_of_string s) }
    | "("               { OPEN }
    | ")"               { CLOSE }
    | "="               { EQUAL }
    | "+"               { PLUS }
    | "-"               { MINUS }
    | "*"               { TIMES }
    | "/"               { DIVIDE }
    | [' ''\t']+        { token lexbuf }
    | _                 { BADTOK }
    | eof               { EOF }