gll-combinators has a very nice syntactic feature which makes it possible to use arity-n functions directly with the ^^ operator (reduction), rather than depending on an arity-1 function that uses deconstruction. For example:
// gll-combinators
a ~ b ~ c ^^ { (a, b, c) => ??? }
// parseback and Scala's parser combinators
a ~ b ~ c ^^ { case a ~ b ~ c => ??? }
Obviously, the gll-combinators version is a lot nicer, especially once you expand this out to line tracking and other complications. Unfortunately, it requires some extremely annoying type-level machinery to make it work. Here is the gll-combinators implementation. The reason this is so annoying is the need to deal with every associative permutation of the ~ operator. In theory, it should be possible to derive this at the type level in Scala, resulting in a more linear growth of implicit cases (as opposed to the current quadratic), but I haven't found a way yet. (puts the bat signal in the sky for @milessabin)
gll-combinators has a very nice syntactic feature which makes it possible to use arity-n functions directly with the
^^
operator (reduction), rather than depending on an arity-1 function that uses deconstruction. For example:Obviously, the gll-combinators version is a lot nicer, especially once you expand this out to line tracking and other complications. Unfortunately, it requires some extremely annoying type-level machinery to make it work. Here is the gll-combinators implementation. The reason this is so annoying is the need to deal with every associative permutation of the
~
operator. In theory, it should be possible to derive this at the type level in Scala, resulting in a more linear growth of implicit cases (as opposed to the current quadratic), but I haven't found a way yet. (puts the bat signal in the sky for @milessabin)