[Haskell-cafe] Re: Frisby grammars that have context

Isaac Dupree isaacdupree at charter.net
Tue May 29 19:28:02 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

apfelmus wrote:
> Isaac Dupree wrote:
>> apfelmus wrote:
>>> Mark T.B. Carroll wrote:
>>>> I've been playing with Text.Parsers.Frisby to see how it stacks against
>>>> other options and, while it's been great so far, I am finding that I
>>>> can't encode a grammar where what's acceptable depends on what's already
>>>> been parsed in some nontrivial way.
>>>> [...]
>>>> Is this supposed to not be possible in Frisby, or (quite likely) am I
>>>> missing something that allows me to?
>>> It's intentionally impossible. Frisby uses a dynamic programming
>>> approach that crucially depends on the fact that the grammar in question
>>> is context-free (actually something related, but the effect is the
>>> same).
>> Is that dependence crucial? What if it gained Monad operations that just
>> weren't intended to be used very often, and maybe locally harmed
>> performance a little where they are used?
> 
> Now that you ask, I become unsure

Luckily, Haskell's laziness means that doing an extra "postprocessing
pass" doesn't necessarily yield two traversals requiring the whole file
to be stored in memory, nor worse hacks.  (For grammars that aren't too
wild / sequential)

Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXLcBHgcxvIWYTTURArCuAJ9mR8HFqiRNT7teWjhvAtRwXYgjfwCgu7hi
YEXGLGvMVHQwlZpfxTDi0FI=
=b3Q7
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list