% A top-down, depth-first Prolog parser
% progtddf.pl
:- op(1200, xfx, --->).
:- op(1200, xfx, ===>).
td_parse(Cat,[Word|RestofString],RestofString) :-
   (Cat===> [Word]).
td_parse(Mother, S0,S) :-
    (Mother ---> Daughters),
   td_parse_dtrs(Daughters,  S0, S).
td_parse_dtrs([],S, S).
td_parse_dtrs([Cat|Cats], S0, S) :-
   td_parse(Cat, S0, S1),
   td_parse_dtrs(Cats, S1, S).