-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Currently state is exposed in grammars
sealed abstract class Grammar[-SI, +SO, +E, A]This results in state container (a Tuple) being allocated and returned at each step of execution
case Grammar.GADT.Produce(a) => (s: S, i: Input) => (s, Right((i, a)))which is a huge performance overhead.
What if state is only returned at the very end?
So instead of
def parser[S, E, A](grammar: Grammar[S, S, E, A]): (S, Input) => (S, E \/ (Input, A))we have
def parser[E, A](grammar: Grammar[E, A]): Input => (State, E \/ (Input, A))Reactions are currently unavailable