With regard to the "skip to" expression, if it's helpful, I got good 
performance results implementing x -> t as a fresh non-terminal (like 
repetition):

N := t / x N

It uses the ordered choice property of PEGs to avoid double-testing t as in (!t 
x)* t

Well, s= (e)* in PEG is equivalen to s= S ; S = e S | epsilon. 

I’ve thought about using recursion to resolve closures in TatSu, to make the 
code clearer, and the algorithms “prettier”, but iteration is much more 
effective in Python.

My repeating expressions are also implemented iteratively, but the shift to a 
dedicated expression that only checked the terminating expression once was 
still a win.

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to