Script started on XXX XXX XX 11:54:43 XXXX > cat g2.p snt --> det(F, Number), adjs(F), noun(Number), verb(Number). det(F, sing) --> [a], { F = consonant } ; [an], { F = vowel }. det(_, plur) --> [the]. adjs(F) --> adj(F); adj(F), adjs(_). adj(F) --> [spotted], { F = consonant } ; [endangered], { F = vowel } ; [poison_arrow], { F = consonant }. noun(Num) --> [frog], { Num = sing } ; [owl], { Num = sing } ; [frogs], { Num = plur } ; [owls], { Num = plur }. verb(Num) --> [hops], { Num = sing } ; [hop], { Num = plur } ; [swims], { Num = sing } ; [swim], { Num = plur } ; [hunts], { Num = sing } ; [hunt], { Num = plur } ; [flies], { Num = sing } ; [fly], { Num = plur }. > pl Welcome to SWI-Prolog (Multi-threaded, Version 5.6.24) Copyright (c) 1990-2006 University of Amsterdam. SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). ?- ['g2.p']. % g2.p compiled 0.00 sec, 5,624 bytes Yes ?- snt(X,[]). X = [a, spotted, frog, hops] ; X = [a, spotted, frog, swims] ; X = [a, spotted, frog, hunts] ; X = [a, spotted, frog, flies] ; X = [a, spotted, owl, hops] ; X = [a, spotted, owl, swims] ; X = [a, spotted, owl, hunts] ; X = [a, spotted, owl, flies] ; X = [a, poison_arrow, frog, hops] ; X = [a, poison_arrow, frog, swims] ; X = [a, poison_arrow, frog, hunts] Yes ?- Det = the, snt([Det | Rest], []), X = [Det | Rest]. Det = the Rest = [spotted, frogs, hop] X = [the, spotted, frogs, hop] ; Det = the Rest = [spotted, frogs, swim] X = [the, spotted, frogs, swim] ; Det = the Rest = [spotted, frogs, hunt] X = [the, spotted, frogs, hunt] ; Det = the Rest = [spotted, frogs, fly] X = [the, spotted, frogs, fly] ; Det = the Rest = [spotted, owls, hop] X = [the, spotted, owls, hop] ; Det = the Rest = [spotted, owls, swim] X = [the, spotted, owls, swim] ; Det = the Rest = [spotted, owls, hunt] X = [the, spotted, owls, hunt] ; Det = the Rest = [spotted, owls, fly] X = [the, spotted, owls, fly] ; Det = the Rest = [endangered, frogs, hop] X = [the, endangered, frogs, hop] ; Det = the Rest = [endangered, frogs, swim] X = [the, endangered, frogs, swim] ; Det = the Rest = [endangered, frogs, hunt] X = [the, endangered, frogs, hunt] ; Det = the Rest = [endangered, frogs, fly] X = [the, endangered, frogs, fly] ; Det = the Rest = [endangered, owls, hop] X = [the, endangered, owls, hop] ; Det = the Rest = [endangered, owls, swim] X = [the, endangered, owls, swim] ; Det = the Rest = [endangered, owls, hunt] X = [the, endangered, owls, hunt] ; Det = the Rest = [endangered, owls, fly] X = [the, endangered, owls, fly] ; Det = the Rest = [poison_arrow, frogs, hop] X = [the, poison_arrow, frogs, hop] ; Det = the Rest = [poison_arrow, frogs, swim] X = [the, poison_arrow, frogs, swim] ; Det = the Rest = [poison_arrow, frogs, hunt] X = [the, poison_arrow, frogs, hunt] ; Det = the Rest = [poison_arrow, frogs, fly] X = [the, poison_arrow, frogs, fly] ; Det = the Rest = [poison_arrow, owls, hop] X = [the, poison_arrow, owls, hop] ; Det = the Rest = [poison_arrow, owls, swim] X = [the, poison_arrow, owls, swim] ; Det = the Rest = [poison_arrow, owls, hunt] X = [the, poison_arrow, owls, hunt] ; Det = the Rest = [poison_arrow, owls, fly] X = [the, poison_arrow, owls, fly] ; Det = the Rest = [spotted, spotted, frogs, hop] X = [the, spotted, spotted, frogs, hop] Yes ?- halt. > exit > script done on XXX XXX XX 12:03:11 XXXX