Skip to content

Instantly share code, notes, and snippets.

@yminsky yminsky/
Created Jan 8, 2016

What would you like to do?
yet better formatting
let rec lexwhile prop inp =
match inp with
| c::cs when prop c ->
let (tok,rest) = lexwhile prop cs in
| _ -> ("",inp)
let rec lex inp =
match snd (lexwhile space inp) with
| [] -> []
| c::cs ->
let prop =
if alphanumeric(c) then alphanumeric
else if symbolic(c) then symbolic
else (fun c -> false)
let (toktl,rest) = lexwhile prop cs in
(c^toktl) :: lex rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.