Template meta-programming for Haskell
Proceedings of the 2002 ACM SIGPLAN workshop on Haskell
Scrap your boilerplate: a practical design pattern for generic programming
Proceedings of the 2003 ACM SIGPLAN international workshop on Types in languages design and implementation
Finite-state approximation of constraint-based grammars using left-corner grammar transforms
COLING '98 Proceedings of the 17th international conference on Computational linguistics - Volume 1
Scrap more boilerplate: reflection, zips, and generalised casts
Proceedings of the ninth ACM SIGPLAN international conference on Functional programming
Type-safe, self inspecting code
Haskell '04 Proceedings of the 2004 ACM SIGPLAN workshop on Haskell
Journal of Functional Programming
Simple unification-based type inference for GADTs
Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming
Applicative programming with effects
Journal of Functional Programming
Grammar Engineering Support for Precedence Rule Recovery and Compatibility Checking
Electronic Notes in Theoretical Computer Science (ENTCS)
Typed transformations of typed abstract syntax
Proceedings of the 4th international workshop on Types in language design and implementation
Typed Transformations of Typed Grammars: The Left Corner Transform
Electronic Notes in Theoretical Computer Science (ENTCS)
Explicitly recursive grammar combinators: a better model for shallow parser DSLs
PADL'11 Proceedings of the 13th international conference on Practical aspects of declarative languages
Grammar fragments fly first-class
Proceedings of the Twelfth Workshop on Language Descriptions, Tools, and Applications
Hi-index | 0.00 |
The Haskell definition and implementation of read is far from perfect. In the first place read is not able to handle the associativities defined for infix operators. Furthermore, it puts constraints on the way show is defined, and especially forces it to generate far more parentheses than expected. Lastly, it may give rise to exponential parsing times. All this is due to the compositionality requirement for read functions, which imposes a top-down parsing strategy. We propose a different approach, based on typed abstract syntax, in which grammars describing the data types are composed dynamically. Using the transformation libraries described in a companion paper these syntax descriptions are combined and transformed into parsers at runtime, from which the required read function are constructed. In this way we obtain linear parsing times, achieve consistency with the defined associativities, and may use a version of show which generates far fewer parentheses, thus improving readability of printed values. The described transformation algorithms can be incorporated in a Haskell compiler, thus moving most of the work involved to compile time.