Error PARSER expected, white space to end file

Hi every one,

I am trying to define a function in my STAN file. But everytime, I run my program, I face this error: PARSER EXPECTED, white space to end file. I have the same error even for the function defined in stan documentation like predictors_rng. Can you please help me with that? This is while if I remove the user defined function, I don’t have error in my program.

Best,
Ellie

Hi Ellie, can you share an example of a complete Stan file that results in that error for you? It will be much easier to help you debug if we can see exactly what your Stan program file looks like.

My guess is that the functions block is in the wrong place. It must be in the first block defined.

But… as @jonah said, it’s much easier to help when we know what the Stan program looks like.