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.

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

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.