Grammar-based analysis of string expressions

  • Authors:
  • Peter Thiemann

  • Affiliations:
  • Universität Freiburg, Freiburg, Germany

  • Venue:
  • TLDI '05 Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

We specify a polymorphic type system for an applied lambda calculus that refines the string type with a subtype hierarchy derived from language containment. It enables us to find a language for each string-type expression such that the value of the expression is a member of that language. Type inference for this system infers language inclusion constraints that can be viewed as a context-free grammar with a nonterminal for each string-valued expression.Then we present two algorithms that solve language inclusion constraints with respect to a fixed context-free reference grammar. The solutions are sound but incomplete because the general problem of context-free language inclusion is undecidable. Both algorithms are derived from Earley's parsing algorithm for context-free languages.Taking the two parts together enables us to answer questions like: Is the value of a string-type expression derivable from a given nonterminal in the reference grammar?