at the moment I am having a problem with looping back to noun_phrase from np2. I was wondering if someone can help me loop back to nounphrase. Here is some code:

noun_phrase([X|T],(det(X), NP2),Rem):-
det(X),
np2(T,NP2,Rem).

np2([H|T],np2(adj(H),Rest),NP) :- adj(H), np2(T,Rest,Rem), noun_phrase(NP,Rem,_).

I want to loop from np2 back to noun_phrase. I think the code for np2 is wrong as I just hacked it together.

Prolog has not loops. I do not understand what you try to accomplish as we have not any examples of input or expected output.