Created
January 18, 2013 05:36
-
-
Save PollRobots/4562581 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| | Sequence x -> | |
| let rec parseList lst off = | |
| seq { | |
| if List.isEmpty lst then () | |
| else | |
| match parse off <| List.head lst with | |
| | (Unmatched, _) as y -> yield y | |
| | (y, z) -> yield (y, z) | |
| yield! parseList (List.tail lst) z | |
| } | |
| let s = List.ofSeq <| parseList x offset | |
| if List.exists (function | (Unmatched, _) -> true | _ -> false) s then (Unmatched, offset) | |
| else (Production <| List.map fst s, snd <| List.maxBy snd s) | |
| | Choice x -> | |
| let rec parseList lst = | |
| if List.isEmpty lst then (Unmatched, offset) | |
| else | |
| match parse offset <| List.head lst with | |
| | (Unmatched, _) -> parseList <| List.tail lst | |
| | y -> y | |
| parseList x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment