Abstract

We discuss the mechanical transformation of an unambiguous context-free grammar (CFG) into a definite-clause grammar (DCG) using a finite set of examples, each of which is a pair 〈 s, m〉, where s is a sentence belonging to the language defined by the CFG and m is the semantic representation (meaning) of s. The resulting DCG would be such that it could be executed to compute the semantics for every sentence of the original DCG. The motivation for our work comes from the observation that it is not easy to manually augment a CFG with semantic attributes to obtain a DCG because the task of building a correct and efficient DCG requires a fair amount of search, especially when the semantic representations involve quantified terms, as in natural languages. Our proposed approach is based upon two key assumptions: (1) the semantic representation language is the simply typed λ-calculus, and (2) the semantic representation of a sentence is a function (expressed in the typed λ-calculus) of the semantic representations of its parts ( compositionality). With these assumptions, we show how a higher-order DCG can be systematically constructed using a matching procedure for simply typed λ-terms. We then show how to translate the constructed higher-order DCG into a first-order DCG by a partial-execution procedure. We have applied our methodology to the synthesis of the semantics of a small query language, and we believe that this methodology could be a useful tool for generating natural query language front-ends for various applications.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call