si(s(N,V))-->npi(N), vpi(V).

vpi(vi(V))-->vi(V,i).
vpi(vt(V,N))-->vi(V,t), npi(N).
vpi(vm(V,S))-->vi(V,m), [that], si(S).
vpi(v3(V,Cd,Ci))-->vi(V,3), np(Ci), np(Cd).
vpi(v3(V,Cd,Ci))-->vi(V,3), np(Cd), [to], np(Ci).


npi(np(Sp,Sn))-->deti(Sp), np1i(Sn,G,N).

np1i(nome(S),G,N)-->nomei(S,G,N).
np1i(rel(nome(S),S1),G,N)-->nomei(S,G,N), [that], ssnci(S1).

ssnci(ssnc(S))-->vpi(S).
ssnci(ssnc(S,V))-->npi(S), vpi(V).

deti(art(S))-->arti(S).



vi(mia,i)-->[miaaa].
vi(come,t)-->[eats].
vi(pensa,m)-->[thinks].
vi(da,3)-->[gives].

arti(o)-->[the].
arti(um)-->[a].

nomei(ps,f,p)-->[ps].
nomei(gato,m,s)-->[cat].







s(s(N,V))-->np(N), vp(V).

vp(vi(V))-->v(V,i).
vp(vt(V,N))-->v(V,t), np(N).
vp(vm(V,S))-->v(V,m), [que], s(S).
vp(v3(V,Cd,Ci))-->v(V,3), np(Cd), [a], np(Ci).

np(np(Sp,Sn))-->det(Sp,G,N), np1(Sn,G,N).

np1(nome(S),G,N)-->nome(S,G,N).
np1(rel(nome(S),S1),G,N)-->nome(S,G,N), [que], ssnc(S1).

ssnc(ssnc(S))-->vp(S).
ssnc(ssnc(S,V))-->np(S), vp(V).

det(art(S),G,N)-->art(S,G,N).



v(mia,i)-->[mia].
v(come,t)-->[come].
v(pensa,m)-->[pensa].
v(deu,m)-->[deu].

art(o,m,s)-->[o].
art(o,m,p)-->[os].
art(o,f,s)-->[a].
art(o,f,p)-->[as].
art(um,m,s)-->[um].
art(um,m,p)-->[uns].
ar(um,f,s)-->[uma].
art(um,f,p)-->[umas].

nome(ps,f,p)-->[ps].
nome(gato,m,s)-->[gato].

