Montague grammar can represent the meanings of quite complex sentences compactly. Below is a grammar presented in Eijck and Unger's textbook. The types of the syntactic categories in the grammar are as follows, with
t denoting a term (a reference to an entity) and
f denoting a formula. The meaning of a sentence obtained by the rule S : \mathit{NP}\ \mathit{VP} is obtained by applying the function for NP to the function for VP. The types of VP and NP might appear unintuitive because of the question as to the meaning of a noun phrase that is not simply a term. This is because meanings of many noun phrases, such as "the man who whistles", are not just terms in predicate logic, but also include a predicate for the activity, like "whistles", which cannot be represented in the term (consisting of constant and function symbols but not of predicates). So we need some term, for example
x, and a formula
whistles(x) to refer to the man who whistles. The meaning of verb phrases VP can be expressed with that term, for example stating that a particular
x satisfies sleeps(x) \wedge snores(x) (expressed as a function from
x to that formula). Now the function associated with NP takes that kind of function and combines it with the formulas needed to express the meaning of the noun phrase. This particular way of stating NP and VP is not the only possible one. Key is the meaning of an expression is obtained as a function of its components, either by function application (indicated by boldface parentheses enclosing function and argument) or by constructing a new function from the functions associated with the component. This compositionality makes it possible to assign meanings reliably to arbitrarily complex sentence structures, with auxiliary clauses and many other complications. The meanings of other categories of expressions are either similarly
function applications, or
higher-order functions. The following are the rules of the grammar, with the first column indicating a
non-terminal symbol, the second column one possible way of producing that non-terminal from other non-terminals and terminals, and the third column indicating the corresponding meaning. Here are example expressions and their associated meaning, according to the above grammar, showing that the meaning of a given sentence is formed from its constituent expressions, either by forming a new higher-order function, or by applying a higher-order function for one expression to the meaning of another. The following are other examples of sentences translated into the predicate logic by the grammar. ==In popular culture==