[Haskell-cafe] Consuming anyToken with parsing with derivatives (derp) library in Hackage?
Ahn, Ki Yung
kyagrd at gmail.com
Fri Nov 11 13:41:21 CET 2011
I was playing with derp recently, and many of the Char and Combinator of
Parsec seem to be easily definable from derp. However, I haven't yet
figured out a natural way to define anyToken or satisfy combiator of
Parsec using derp. There is a way of course, to list all the unicode
characters and combine them with <|>, which is extremely inefficient,
even if you limit yourself that satisfy combinator be compile time
template haskell function, it still seems a bit silly.
For things like space, it seems reasonable to list all take the sum of
them, since there are handful of them. But things like consume anything
that is not a space ought to be defined as a complement or negation of
the space parser.
In general CFG is not closed under negation, but most of the time what
we want to take a negation is really for regular fragment of the
language, like consuming anything that is not a linebreak to lex/parse
one line comments.
In Matt's Standford talk, he mentioned some vision about going beyond
CFG and he mentioned negation, but in the library implementation I
didn't find that. Is it already possible with some trick?
Is there a standard way to define such combinators with derp? Or, is it
the case that there a way to do it in the scheme library but not
implemented in Haskell derp package? I read through the scheme
implementation too but there didn't seem to be a combinator for tacking
Ki Yung Ahn
More information about the Haskell-Cafe