
26 Feb
2011
26 Feb
'11
12:33 p.m.
I don't think typeclasses or a type family will solve the problem directly. Both the statement parsers are producing concrete types - type class polymorphism won't be able to create a union of the two concrete types - a concrete sum type (i.e. Either) will be able to make the union, but it would make the grammar messy. Making an extensible parser for a language as big as C will be tricky. Tim Sheard and Emir Pasalic have done it for a small language in this paper - they use a technique that doubles the number of constructors. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.8983 Best wishes Stephen