% file: bup (bottom-up parser)
% query: parse([orlando,sleepeth])?

% interface
parse(S) :- bup(lex,_,s,S,[]).

% exit condition
bup(Goal, _, Goal,S,S) :- !.

% lexical rules
bup(lex, np, Goal,[orlando|S1], S) :-
    bup(np, _, Goal,S1,S).

bup(lex, vp, Goal,[sleepeth|S1], S) :-
    bup(vp, _, Goal,S1,S).

% corresponds to s --> np, vp
bup(np, s, Goal, S0, S) :-
    bup(lex ,_ ,vp, S0, S1),
    bup(s, _, Goal, S1, S).

