Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Printf;;
- open Stream;;
- type sign =
- Plus
- | Minus;;
- type atom =
- T
- | NIL
- | Int of int
- | Ident of string;;
- type token =
- Lparen
- | Rparen
- | Dot
- | Sign of sign
- | Atom of atom;;
- Stream.t char s from "lines.txt";;
- let rec spaces s=
- match s with parser
- [< '' '|' 't' | 'n' ; _ >] -> spaces s (* ERROR HERE ON '[<' *)
- | [< >] -> ()
- ;;
- let rec lexid str s =
- match s with parser
- [< ' 'a'..'z'| 'A'....'Z'| '0'...'9' as c; _ >] -> lexid (str ^ (Char.escaped c)) s
- | [< >] -> str;;
- let rec lexint v s=
- match s with parser
- [< ‘’0’..’9’ as n; _ >] -> lexint ((10*v)+(int_of_string(Char.escaped n))) s
- | [< >] -> v
- ;;
Add Comment
Please, Sign In to add comment