Re:A micro compiler in Ocaml
by kristianp on Tuesday April 01, 2014 @03:11AM
(#7506608)
Informative comment, but surely the purpose of the article is to teach ocaml, not the lexing&parsing tools, which require more ocaml knowledge?
[ Parent
| on HN ]
The author doesn't appear to be an experienced OCaml programmer, and misses lots of opportunities for simpler code. For example
let is_digit c = let code = Char.code c in code >= Char.code('0') && code <= Char.code('9')
Could have been written: let is_digit = function '0'..'9' -> true | _ -> false
So the purpose probably wasn't to teach OCaml.