Skip to content

Instantly share code, notes, and snippets.

@objmagic
Created July 19, 2015 21:22
Show Gist options
  • Select an option

  • Save objmagic/9f38f07c37e7088d1fe8 to your computer and use it in GitHub Desktop.

Select an option

Save objmagic/9f38f07c37e7088d1fe8 to your computer and use it in GitHub Desktop.
rec.ml
type t2 = A of t3 | C of char and t3 = t2
let rec t2_parser = NT (lazy (
either [(fun arr -> A arr) <*> arr_parser;
((fun c -> C c) <*> lit 'c')]))
and arr_parser = NT (lazy (
(lit '[') >> t2_parser << (lit ']')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment