Luke pretty much nailed the summary of what you can parse using Applicative means. I tend to consider them "codata CFGs", because they can have infinite breadth and depth. However, a 'codata CFG' can handle a much larger class of languages than CFGs. To that end, it is interesting to consider that to maximize the ability to successfully parse such degenerate grammars you are well served to use a traversal that can handle both of those cases. Such a traversal can be built out of Luke's Omega monad or a logic monad with fair conjunction/disjunction and provides a straightforward if inefficient 'top-down' parser.
On Jan 28, 2010, at 9:31 PM, Luke Palmer wrote:Did you think of "Data types à la carte" by Wouter Swierstra?
I don't remember the name, but there is a technique where you compose
the features you want and then take its fixed point to get your AST.
http://www.cs.nott.ac.uk/~wss/Publications/DataTypesALaCarte.pdf
I don't fully understand this sentence but it reminds me of "Finally Tagless, Partially Evaluated" by Jacques Carette, Oleg Kiselyov and Chung-chieh Shan:You can make a typeclass for each feature that uses it on any data
structure in which it is present.
http://www.cs.rutgers.edu/~ccshan/tagless/jfp.pdf