Created
July 15, 2010 08:20
-
-
Save nishio/476656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec tokenize (data : char list) : token list = | |
match data with | |
'['::xs -> Begin::(tokenize xs) | |
| ']'::xs -> End::(tokenize xs) | |
| '+'::xs -> (Inc 1)::(tokenize xs) | |
| '-'::xs -> (Dec 1)::(tokenize xs) | |
| '>'::xs -> (Right 1)::(tokenize xs) | |
| '<'::xs -> (Left 1)::(tokenize xs) | |
| '.'::xs -> Print::(tokenize xs) | |
| ','::xs -> Read::(tokenize xs) | |
| _::xs -> (tokenize xs) | |
| [] -> [] | |
;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment