Hello List,
I've just started using and working on a packrat parser.
My specific problem is that I have an input language that I want to
transform into an output language and collect some data about what
occured during the parse.
As a simple example, imagine the following grammar and code:
start <- a b c / b
a <- 'a' {print "a"}
b <- 'b' {print "b"}
c <- 'c' {print "c"}
If I give the input "ab", this is is not a valid string, but if the
code immediately executes during the parse, It will print both "a"
and "b". A more complex example might parse a fair part of the input
before backtracking.
Given that backtracking could make code executed in-place like this
invalid, what is typical in a packrat parser if the code can be
specified inline like this?
Do I limit myself to non-destructive (functional) operations? Do I
collect the code snippets and execute all of them after a valid parse?
Something else?
Thank you for your help,
-Alan
--
.i ko djuno fi le do sevzi
_______________________________________________
PEG mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/peg