From ca9cae722669cb392f513a4297e388bc00baaa1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Mon, 18 Feb 2019 17:56:37 +0100 Subject: [PATCH] Document treatment of several Matlab statements in one line. Manually cherry-picked from 20b51b3c0815e8ad1a87ff097c7e6eb1fab34c85. --- src/source/running-dynare.rst | 7 +++++++ src/source/the-model-file.rst | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/source/running-dynare.rst b/src/source/running-dynare.rst index 466ab9fd0..0073eeceb 100644 --- a/src/source/running-dynare.rst +++ b/src/source/running-dynare.rst @@ -496,3 +496,10 @@ expect. Hence, it throws an error of the form: ``ERROR: <>: line 2, cols 0-9: syntax error, unexpected PARAMETERS``. In this case, you would simply place a semicolon at the end of line one and the parser would continue processing. + +It is also helpful to keep in mind that any piece of code that does not violate +Dynare syntax, but at the same time is not recognized by the parser, is interpreted +as native Matlab code. This code will be directly passed to the ``driver`` script. +Investigating ``driver.m`` file then helps with debugging. Such problems most often +occur when defined variable or parameter names have been misspelled so that Dynare's +parser is unable to recognize them. diff --git a/src/source/the-model-file.rst b/src/source/the-model-file.rst index e1602409b..840d397f0 100644 --- a/src/source/the-model-file.rst +++ b/src/source/the-model-file.rst @@ -19,6 +19,13 @@ A model file contains a list of commands and of blocks. Each command and each element of a block is terminated by a semicolon (;). Blocks are terminated by ``end;``. +If Dynare encounters an unknown expression at the beginning of a line +or after a semicolon, it will parse the rest of that line as native +Matlab code, even if there are more statements separated by semicolons +present. To prevent cryptic error messages, it is strongly recommended +to always only put one statement/command into each line and start a +new line after each semicolon. + Most Dynare commands have arguments and several accept options, indicated in parentheses after the command keyword. Several options are separated by commas. @@ -424,7 +431,7 @@ symbol name with a vertical line (``|``, pipe character) and either an ``e``, an ``alphaa`` in the model block, you could write ``alphaa|p`` directly in an equation where it appears. Similarly, to declare an endogenous variable ``c`` in the model block you could write ``c|e``. Note that in-equation - on-the-fly variable declarations must be made on contemporaneous variables. +on-the-fly variable declarations must be made on contemporaneous variables. On-the-fly variable declarations do not have to appear in the first place where this variable is encountered.