diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2024-10-02 22:06:16 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2024-10-02 22:06:16 -0300 |
commit | 33518551e019f4dab7d95c9390c66b6b8b2339f2 (patch) | |
tree | 7c21f5ce849154579ba6ff295613917f7f186685 /notes.md | |
parent | aabcaf712f67ac88ec8bd32b5477f17c1a182080 (diff) | |
download | monparser-33518551e019f4dab7d95c9390c66b6b8b2339f2.tar.gz monparser-33518551e019f4dab7d95c9390c66b6b8b2339f2.zip |
Move the project into a new path of breadth first parsing
Diffstat (limited to 'notes.md')
-rw-r--r-- | notes.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..9eddec5 --- /dev/null +++ b/notes.md @@ -0,0 +1,22 @@ +# Problem +When in a one-of block, it's harder to tell where an error came from. + +# Current solution +We have critical blocks that stop parsing when the parser inside fails. + +# Problem with current solution +We need to be dilligent in placing critical blocks. + +# Another approach +We could take a page from LR parsers and instead of driving the parsing from the parsers themselves we invert the flow, making the input drive the parsing. This results in a breadth first parsing, where the one-of block parses one step of every of it's children and decides which to keep. In the event there's only one children left, it is critical, so a failure stops parsing and reports the error. + +# How to select between BF and DF when parsing +Add an extra argument to parser type (lambda (input)) for the parsing mode. +one-of will be BF and comp will be DF. +This means that the immediate children of a one-of block will be parsed step by step. + +# Implementing BF in bind +Instead of calling the resulting function with the input, return it. +It will be the caller's responsibility to call the resulting lambda with the appropiate input. +This will give control to the one-of block to call the next parsing step. + |