%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % parsing examples % % the logic program is the grammar. % the ordered context is the input to be parsed. % % % % small_parser.ll example from Lolli distribution % % snt : atm. snt1 : atm. np : atm. vp : atm. tv : atm. stv : atm. sbar : atm. det : atm. pn : atm. n : atm. rel : atm. whom : atm. the : atm. that : atm. man : atm. woman : atm. girl : atm. boy : atm. mary : atm. bob : atm. jill : atm. loves : atm. married : atm. believes : atm. % % the parse grammar % note that unlike in Lolli (or lambda-Prolog) everything can % remain propositional. % snt_0 : prog(^ np =>> ^ vp =>> ^ snt). snt1_0 : prog(^ np =>> (^ np =0 ^ vp) =>> ^ snt1). vp_0 : prog(^ tv =>> ^ np =>> ^ vp). vp_1 : prog(^ stv =>> ^ sbar =>> ^ vp). % % note: (^ that) is before (^ snt) in the context % done in this manner to prevent looping % sbar_0 : prog(^ snt =>> ^ that >=> ^ sbar). np_0 : prog(^ det =>> ^ n =>> ^ np). np_1 : prog(^ det =>> ^ n =>> ^ rel =>> ^ np). np_2 : prog(^ pn =>> ^ np). % % Adding a ^ np at end of context, insures that gap % is at end of phrase so no need for quantifiers. % Also (^ whom) is before (^ np =>> ^ snt) % % rel_0 : prog( (^ np =>> ^ snt) =>> ^ whom >=> ^ rel). % rel_1 : prog( ((^ np =>> (^ np =0 ^ vp) =>> ^ snt) =0 ^ snt) =>> ^ whom >=> ^ rel). rel_0 : prog( ^ snt1 =>> ^ whom >=> ^ rel). det_0 : prog( ^ the =>> ^ det). n_man : prog( ^ man =>> ^ n). n_woman : prog( ^ woman =>> ^ n). n_girl : prog( ^ girl =>> ^ n). n_boy : prog( ^ boy =>> ^ n). pn_mary : prog( ^ mary =>> ^ pn). pn_bob : prog( ^ bob =>> ^ pn). pn_jill : prog( ^ jill =>> ^ pn). tv_loves : prog( ^ loves =>> ^ tv). tv_married : prog( ^ married =>> ^ tv). tv_believes : prog( ^ believes =>> ^ stv).