[Haskell-cafe] Syntax programming with lexemes rather than trees?
ndmitchell at gmail.com
Tue Mar 23 16:43:11 EDT 2010
It actually sounds like your representation has structure, but you
dislike structure because it's hard to work with. The solution is a
generics library, and I recommend Uniplate:
Imagine you have a ridiculously complex AST, with beam groups under
tuplets etc, and you want to delete the first item from every beam
where f (Beam (x:xs)) = Beam xs
f x = x
Uniplate moves through tuplets and any other hierarchical syntax, so
you just specify the transformation. My guess is if you throw away the
structure then you'll need it back for some operations.
2010/3/22 Stephen Tetley <stephen.tetley at gmail.com>:
> Hi Malcolm
> Thanks - particularly I don't want to go to an AST because its I'm
> finding it too convoluted 'shape wise' - processing beam groups inside
> tuplets etc. is a nightmare - music representations have had at least
> eight centuries of ad hoc extension.
> I know Norman Ramsey and colleagues papers on low-level
> representations - I'll give them a re-reading.
> Thanks again
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe