Can dynare solve this linear system?

i want to use dynare to solve a linear system like this(some parameters may not be used in the model):
-----------------------------------the line.mod-----------------------------------------
var y i pai q qstar;
varexo eps1 eps2 eps3 eps4;
parameters a1 a2 phi beta sigma1 sigma2 b1 b2 gama1 gamma1s gama2 gama3 gama4 r pais;
a1 = 0.4;
a2 = 0.1;
phi = 0.8;
beta = 0.1;
sigma1 = 0.4;
sigma2 = 0.8;
b1 = 0.5;
b2 = 0.3;
gama1 = 0.8;
gama1s = 3;
gama2 = 0.1;
gama3 = 0.1;
gama4 = 0.85;
r = 0.035;
pais = 0.025;
model(linear);
qstar = sigma2y(+1)-sigma1(i-pai(+1))+eps3;
pai = (1-phi)pai(+1)+phipai(-1)+betay+eps2;
y = y(+1)-a1
(i(-1)-pai)+a2q(-1)+eps1;
q = (b1-b2)q(-1)-b1(q(-2)+b2
qstar;
i = (1-gama4)(r+pai+gama1(pai)+gama2y+gama3(q-qstar))+gamam4*i(-1)+eps4;
end;
initval;
qstar = 1;
pai = 0;
y = 0.1;
q = 1;
i = 0;
shocks;
var eps1; stderr 0.01;
var eps2; stderr 0.01;
var eps3; stderr 0.01;
var eps4; stderr 0.01;
end;
steady;
check;
stoch_simul(periods=2100);

however, the matlab said “qstar is an unrecognized symbol”, the linear system is from"Should Monetary Policy Respond to Asset Price Misalignments?" with a little adjustment. i can not figure out whether the reason is dynare can not solve this type system or it is my wrong coding. could somebody help me with this problem?
line.mod (911 Bytes)
Should Monetary Policy Respond to Asset Price Misalignments.pdf (256 KB)

q = (b1-b2)*q(-1)-b1*(q(-2)+b2*qstar;

misses a bracket at the end.

i = (1-gama4)*(r+pai+gama1*(pai)+gama2*y+gama3*(q-qstar))+gamam4*i(-1)+eps4;

gamam4 should be gama4

The initval block misses an end;
line.mod (831 Bytes)

thank you in advance. the dynare run it well.