Functional-Logic Graph Parser Combinators

  • Authors:
  • Steffen Mazanek;Mark Minas

  • Affiliations:
  • Universität der Bundeswehr, München, Germany;Universität der Bundeswehr, München, Germany

  • Venue:
  • RTA '08 Proceedings of the 19th international conference on Rewriting Techniques and Applications
  • Year:
  • 2008

Quantified Score

Hi-index 0.02

Visualization

Abstract

Parser combinators are a popular technique among functional programmers for writing parsers. They allow the definition of parsers for string languages in a manner quite similar to BNF rules. In recent papers we have shown that the combinator approach is also beneficial for graph parsing. However, we have noted as well that certain graph languages are difficult to describe in a purely functional way.In this paper we demonstrate that functional-logic languages can be used to conveniently implement graph parsers. Therefore, we provide a direct mapping from hyperedge replacement grammars to graph parsers. As in the string setting, our combinators closely reflect the building blocks of this grammar formalism. Finally, we show by example that our framework is strictly more powerful than hyperedge replacement grammars.We make heavy use of key features of both the functional and the logic programming approach: Higher-order functions allow the treatment of parsers as first class citizens. Non-determinism and logical variables are beneficial for dealing with errors and incomplete information. Parsers can even be applied backwards and thus be used as generators or for graph completion.