# ?Syntax error, unexpected \$end dynare?

Dear friends,
i am a beginner to DSGE, and confused by the error notice after running this simple NK.mod. NK.mod (1.3 KB)

Appendix of code//NK model
//NK model
var Y I C R K W L MC P PI A;
varexo e;
parameters sigma phi alpha beta delta rhoa psi theta;

sigma = 2;
phi = 1.5;alpha = 0.35;beta = 0.985; delta = 0.025; rhoa = 0.95; psi = 8;theta = 0.75;

model(linear);
#Pss = 1;
#MCss = ((psi-1)/psi) *(1-beta *theta) *Pss;
#Kss = alpha * MCss * (Yss/Rss);
#Iss = delta * Kss;
#Css = Yss - Iss;
#Lss = (1-alpha) * MCss * (Yss/Wss);

//1-Labor supply
sigma *C + phi *L = W - P;
//2-Euler equation
//3-Law of motion of capital
K = (1-delta) *K(-1) + delta *I;
//4-Production function
Y = A + alpha *K(-1) + (1-alpha) *L;
//5-Demand for capital
K(-1) = Y - R;
//6-Demand for labor
L = Y - W;
//7-Marginal cost
MC = (1-alpha) *W + alpha *R - A;
//8-Phillips equation
PI = beta *PI(+1)+((1-theta) *(1-beta *theta)/theta) *(MC-P);
//9-Gross inflation rate
PI = P - P(-1);
//10-Goods market equilibrium condition
Yss *Y = Css *C + Iss *I;
//11-Productivity shock
A = rhoa *A(-1) + e;
end;

check(qz_zero_threshold=1e-20);

shocks;
var e;
stderr 0.01;
end;

stoch_simul(nograph,qz_zero_threshold=1e-20) Y I C R K W L PI A;

It seems that the code works well in windows while fails in OS.

I tried it out - It at first reported errors, but if I copy and paste codes in a new file, things are all fine. There must be some kind of weird mysterious bugs. (I use windows)

@HoutanBastani @sebastien I can actually replicate the issue on Windows in both Octave and Matlab. Something in the parsing of the file goes wrong. If I copy its contents to a different file, the issue is gone. But I cannot see any invisible characters in the file that might cause this.

The problem is that the line endings in the file are “Mac” style.

@kzcaitec what editor did you use to make this file and how did you save the it?

I use Matlab and save it as .mod file.

Indeed. After pasting without format, the error is gone.Thanks for your attention.

@kzcaitec could you please tell me what version of Matlab/macOS you used when this problem occurred? Thanks in advance