Enhance the simple grammar and revise the parse/0 program to return the syntax tree in a form of a structure
The revised program should behave as follows:
?- parse_tree.
Type the sentence and put a full stop at the end
|: the man eats the monkey.
End of Lexical Analysis. The List of words is:
[the,man,eats,the,monkey,.] The list of tokens for the syntax check (parsing) is:
[the,man,eats,the,monkey]
The sentence is parsed correctly!!
The Parse Tree is: s(np(art(the),n(man)),vp(v(eats),np(art(the),n(monkey))))
Hint: You can revise the clauses of the original grammar to include a return argument. For instance: sentence(s(NP,VP)) --> noun_phrase(NP), verb_phrase(VP).