Created
December 1, 2013 23:48
-
-
Save robotlolita/7742455 to your computer and use it in GitHub Desktop.
Parsing combinators in LS
This file contains 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
export char = (a) -> (state) -> | |
state.consume 1 .chain (b) -> | |
| a is b => Either.Right [state.skip 1; b] | |
| otherwise => Either.Left [state; "Expected #a, found #b."] | |
.or-else -> | |
Either.Left [state; "Expected #a, but reached the end of the input."] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment