[Haskell-cafe] Parsec to parse tree structures?

wren ng thornton wren at freegeek.org
Wed Mar 17 19:53:41 EDT 2010

david fries wrote:
> My my concern was how you would perform random access in a functional
> parser. You're points are interesting too. I guess if we really had
> wanted to work with parsed objects, retaining the shared references
> would have been a must.

Out of curiosity, was there *really* a need for random access? It sounds 
like you could've written things to do it in one forward pass, keeping a 
table on the side of the targets for dangling pointers, and then 
back-patching once you've reached the object being pointed at. You may 
even be able to use laziness to do the back-patching instead of needing 
STRefs. The only problem I could see with that approach is if there was 
funny bit-packing going on so that objects were overlapped in the same 
memory region.

Live well,

More information about the Haskell-Cafe mailing list