Last active
August 29, 2015 14:24
-
-
Save objmagic/cf5cc8c1554bf677fe43 to your computer and use it in GitHub Desktop.
escape
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
| type _ grammar = | |
| | Either : 'a grammar list -> 'a grammar | |
| | CharLiteral : char -> char grammar | |
| type state | |
| type 'a result = Ok of 'a | Failure of string | |
| type 'a parser_code = state code -> 'a result code | |
| type 'a parser_generator = | |
| 'a grammar -> 'a parser_code | |
| let gen_charlit_parser : char -> char parser_code = assert false | |
| let gen_either_parser: ('a parser_code) list -> 'a parser_code = assert false | |
| let rec gen_parser : type a. a parser_generator = fun c state -> | |
| match c with | |
| | CharLiteral c -> gen_charlit_parser c state | |
| | Either grammar_list -> | |
| gen_either_parser (List.map gen_parser grammar_list) state |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error message given by compiler does not help at tall