Subversion Repositories programming

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
107 ira 1
/* A simple grammar for English sentences */
2
 
3
/* after Clocksin & Mellish, 4th edition, pages 204ff */
4
 
5
sentence(X) :- np(Y), vp(Z), append(Y,Z,X).
6
 
7
np(X) :- determiner(Y), noun(Z), append(Y,Z,X). 
8
 
9
vp(X) :- verb(Y), np(Z), append(Y,Z,X).
10
 
11
vp(X) :- verb(X).
12
 
13
determiner([the]).
14
 
15
noun([cat]).
16
noun([dog]).
17
 
18
verb([chases]).
19
verb([eats]).
20
verb([sings]).
21
 
22