This grammar implements one of Michael Moortgat's solutions to implementing the q(A,B,C) generalized quantifier in multimodal categorial grammars. (C /1 (A \2 B)) •1 (A \2 A)
The example sentences illustrate the ambiguities which arise when wh extraction and generalized quantifiers interact.
The source file uses custom first order labeling to restrict the axiom links and in many cases, such as the example phrase Fred thinks every schoolboy believes a mathematician wrote Through the Looking Glass, only the correct axiom links are generated.