i'm trying to write a program that translate a prolog sentence to a formal english sentence. here is my code :
sentence --> [if],[the], first_phrase, second_phrase.
first_phrase --> predicate, det , assertion, det, noun.
second_phrase --> [then],[the], predicate, det , noun.
assertion --> noun, [and], [the], predicate.
det --> [are].
det --> [is].
noun --> [flat].
noun --> [webbed].
noun -->[waterfowl].
predicate --> [feet].
predicate --> [bill].
predicate -->[order].
sentence(S1,S3) :- first_phrase(S1,S2), second_phrase(S2,S3).
first_phrase(S1,S3) :- second_phrase(S1,S2), noun(S2,S3).
second_phrase(S1,S3) :- assertion(S1,S2), first_phrase(S2,S3).
det([is|X], X).
det([are|X], X).
the output of this code is like the following : X = [if, the, feet, are, flat, and, the, feet, are|…] so it's missing some words, where it should display some thing like this : If the feet are webbed and the bill is flat then the order is waterfowl.
what should i add or fix in order to get this result ?