Hello I have idea similar to NFA idea about year ago on
[email protected].
We can easily support left recursion and eliminate problems of type X | X Y and
X* X In following way
In grammar we restrict recursion to left and rigth recursion(which we can
rewrite as iteration) and well nested recursion.
Well nested recursion means that recursive rule application must occur only in
area surrounded by keyword nested. This area will have deterministic result.
As example we show arithmetic parser
mul = number
mul "*" mul
| nested("(" add ")")
add = add "+" mul
Notice that if we treat nested(expression) as oracle and inline other rules we
get regular language. We use NFA and relax ordered choice to
match first choice which has continutation to accepted state and repetition to
match most repetitions that we can still accept input.
Another nice thing is that we get code completition and error detection almost
for free.
I am working to create program in ruby with syntax similar to ometa.
--
stop bit received
_______________________________________________
PEG mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/peg