blob: 6705ffd9ce75542504a6acd1843399c873f612e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
Parser Generator
================
This parser generator expands on [this paper](https://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf).
The goal is to have a good enough parser generator for use in my other personal projects.
# The type of parsers
Parsers are lambdas that receive some *input* and return either a *parsing* or a *failure*.
A *parsing* denotes a successful execution of the parser on the given input.
Failures can be either *normal-failure* or *critical-failure*.
The distinction of failure types allows to discern between an input that needs to be
parsed with another parser, and a syntax error.
## Interaction with parser control flow
### Choice (either)
- parsing -> exit
- normal-failure -> continue
- critical-failure -> exit
### Sequence (comp)
- parsing -> continue
- normal-failure -> exit
- critical-failure -> exit
|