;;; Parser for natural language database front end

:- prolog_language("pop11").

lib grammar;

vars dbgrammar, dblexicon;

[
 [s   [np vp]]
 [np  [det snp] [propn] [pron]]
 [snp [adj noun] [noun]]
 [vp  [verb np] [verb]]
 [propn [snp pn] [pn]]
] -> dbgrammar;

[
 [det the a an each which]
 [adj female male childless]
 [noun man monarch person queen king woman]
 [pn anne george sophia caroline frederick william charlotte
              edward adelaide albert alfred arthur leopold victoria alice
              helena louise beatrice alexandra maud henry john elizabeth
              margaret philip charles andrew]
 [pron who]            
 [verb replaced bore was married]
] -> dblexicon;

setup(dbgrammar,dblexicon);

define parse(sentence) -> res;
   s(sentence) -> res;
   unless res then [] -> res endunless
enddefine;
