3 research outputs found

    A Typed, Algebraic Approach to Parsing

    Get PDF
    In this paper, we recall the definition of the context-free expressions (or µ-regular expressions), an algebraic presentation of the context-free languages. Then, we define a core type system for the context-free expressions which gives a compositional criterion for identifying those context-free expressions which can be parsed unambiguously by predictive algorithms in the style of recursive descent or LL(1). Next, we show how these typed grammar expressions can be used to derive a parser combinator library which both guarantees linear-time parsing with no backtracking and single-token lookahead, and which respects the natural denotational semantics of context-free expressions. Finally, we show how to exploit the type information to write a staged version of this library, which produces dramatic increases in performance, even outperforming code generated by the standard parser generator tool ocamlyacc

    Call-By-Name CPS-Translation as a Binding-Time Improvement

    No full text
    Much attention has been given to the call-by-value continuation passing style (CBV CPS) translation as a tool in partial evaluation, but the call-by-name (CBN) CPS translation has not been investigated. We undertake a systematic investigation of the effect of CBN CPS in connection with partial evaluation and deforestation. First, we give an example where CBN CPS translation acts as a binding time improvement to achieve the effects of deforestation using partial evaluation. The same effect cannot be achieved with CBV CPS. Second, we prove formally that the CBN CPS translation together with partial evaluation has the power to achieve all the effects of deforestation. The consequence of these results is a practical tool (the CBN CPS) for improving the results of partial evaluation, as well as an improved understanding of the relation between partial evaluation and deforestation
    corecore