24.Write a PROLOG program that will take grammar rules.
% PROLOG program that will take grammar rules.
% below sets of function is not predefined you can use any name as function
det([the|X],X):-!.
noun([sohan|X],X).
noun([frog|X],X).
verb([loves|X],X):-!.
sentence(P1,P3):- np(P1,P2),vp(P2,P3).
np(P1,P2):- noun(P1,P2).
np(P1,P3):- det(P1,P2),noun(P2,P3).
vp(P1,P3):- verb(P1,P2), np(P2,P3).