Commit Graph

2368 Commits (b3ec807b902526ca41db5ebfaefac91b6c559841)

Author SHA1 Message Date
Houtan Bastani b3ec807b90
macro processor: move changes from `cd99bb3af9c8ef6fd881fa0457121894f8edd14e` to the header file 2019-08-19 18:31:18 +02:00
Sébastien Villemot 9b9c5beb5c
Ensure that unary ops aux vars are never created when there is a lead
The transformation would be incorrect because of the expectation operator.

There was already a safety check, but it was not entirely correct. For example,
if “exp(y)” was appearing before “exp(y(+1))”, the check would not catch the
problem, because it happened after the substitution table had been filled. So
we now do the check before filling that table.
2019-08-19 18:27:57 +02:00
Sébastien Villemot 3941278832
Add more comments in routines for aux vars for unary ops / diff operators
By the way, do some small code simplifications.
2019-08-19 18:27:57 +02:00
Sébastien Villemot 8e9f6e4c57
Improve some function prototypes for better distinction between input and output arguments 2019-08-19 18:27:57 +02:00
Houtan Bastani cd99bb3af9
macro processor: Make @#include and @#includepath immutable 2019-08-19 18:20:53 +02:00
Houtan Bastani 588896b509
doc: update macro processor doc for `@#elseif` and `defined` 2019-08-19 15:23:51 +02:00
Houtan Bastani b77f6ecd94
macro processor: add `defined` operator 2019-08-19 15:14:51 +02:00
Houtan Bastani 8ebd2a1735
macro processor: support `@#elseif` directive 2019-08-19 15:14:43 +02:00
Sébastien Villemot 75b000a0b5
Macro processor: ensure that all read-accessors return a const reference
Useless copies are thus avoided in some situations.
2019-08-14 17:36:10 +02:00
Sébastien Villemot 8c1e48a09e
Add a few more calls to std::move() 2019-08-14 17:27:31 +02:00
Sébastien Villemot c4f331c74c
Macro processor: make more node classes immutable
Since the node classes are stored and copied as std::shared_ptr, a given class
instance can actually be shared by two different expressions. Hence, in order
to prevent weird bugs, it’s necessary to make these classes immutable.

This commit deals with the easy cases.

The remaining (and more complex) ones are:
— Variable
— Array
— Include
— IncludePath
2019-08-14 17:14:42 +02:00
Sébastien Villemot 46a7cf5db7
Macro processor: fix the use of move semantics in constructor
In particular, remove the const keyword before arguments passed-by-value,
because otherwise they can't be moved (since they are immutable).

Also add a few missing calls to std::move(), and remove some calls to
std::move() when they are useless (on class enums, which are fundamental
types.)
2019-08-14 16:43:45 +02:00
Sébastien Villemot 37e7a6d1c1
Now that we require Bison ≥ 3.2, the stack.hh and position.hh files are no longer generated 2019-08-14 15:36:31 +02:00
Sébastien Villemot b299983a8b
Fix the notmpterms option in the presence of external functions 2019-08-14 15:28:41 +02:00
Sébastien Villemot ecad2dfb10
Avoid running bison and flex multiple times when doing parallel builds 2019-08-14 11:22:33 +02:00
Sébastien Villemot 30aaf93ca7
Bison 3.2 now generates a default semantic action with variants
The minimal required version of Bison is bumped to 3.2, so that we can rely on
those default actions.
2019-08-14 11:22:33 +02:00
Houtan Bastani 2c6a290fb3
remove unnecessary declaration 2019-08-13 13:17:08 -04:00
Houtan Bastani bb13b93d59
aesthetic fix 2019-08-13 12:37:34 -04:00
Sébastien Villemot 5960a9168c
Macro processor: fix the shift/reduce conflict related to ternary colon operator
The idea is to split the expression rule into smaller subrules, hierarchically
organized according to the operator precedence (Bison still does part of the
job of dealing with precedence).
2019-08-13 18:17:14 +02:00
Houtan Bastani 7048a4ff32
macro processor: consolidate precedence rules around unary +/- 2019-08-13 09:56:32 -04:00
Houtan Bastani 0c37da202b
add missing precedence for unary plus 2019-08-13 09:55:41 -04:00
Houtan Bastani 329226b52b
doc: macro processor: update slides for bool type 2019-08-13 09:17:20 -04:00
Houtan Bastani 321f70df21
macro processor: consolidate precedence rules around unary +/- and casting 2019-08-12 16:57:39 -04:00
Houtan Bastani 273c54f7fb
macro processor: introduce functions to test types of variables and literals 2019-08-07 14:16:15 -04:00
Houtan Bastani d35f2609fe
macro processor: implement `isempty` 2019-08-07 11:59:14 -04:00
Houtan Bastani ff6eea7f29
doc: update macro processor doc 2019-08-07 10:56:54 -04:00
Houtan Bastani eeb5600845
more changes missed in `309326c372b140d4e6e459b2139d957c246c6512` 2019-08-07 10:48:25 -04:00
Houtan Bastani 00172ec10b
change missed in `309326c372b140d4e6e459b2139d957c246c6512` 2019-08-07 10:44:11 -04:00
Houtan Bastani 309326c372
macro processor: change name of Double type to Real 2019-08-07 10:37:35 -04:00
Houtan Bastani ddd4361887
macro processor: remove unnecessary `std` namespace specifier 2019-08-06 17:02:25 -04:00
Houtan Bastani fcb1982de8
macro processor: only allow conversion to boolean from strings that precisely contain numeric values or true or false 2019-08-06 17:01:10 -04:00
Houtan Bastani 86538bed1c
macro processor: only allow conversion to double from strings that precisely contain numeric values 2019-08-06 14:48:55 -04:00
Houtan Bastani 76f186faeb
doc: modify macro processor casting examples 2019-08-06 14:16:26 -04:00
Houtan Bastani 618bf7c987
macro processor: remove cast to int 2019-08-06 14:10:11 -04:00
Houtan Bastani 72c216fd7c
macro processor: fix error messages 2019-08-06 11:31:56 -04:00
Houtan Bastani 6cc56430a3
macro processor doc: update for changes 5fc83fad29 to b3798a0baa 2019-08-05 16:46:19 -04:00
Houtan Bastani b3798a0baa
macro processor: introduce bool casts 2019-08-05 16:30:29 -04:00
Houtan Bastani eaa8b8fa84
macro processor: introduce array casts 2019-08-02 17:00:23 -04:00
Houtan Bastani 2b1eedd132
macro processor: introduce tuple casts 2019-08-02 16:56:01 -04:00
Houtan Bastani 7e085855b3
macro processor: introduce string casts 2019-08-02 15:19:00 -04:00
Houtan Bastani 5442512904
macro processor: introduce double casts 2019-08-02 15:03:05 -04:00
Houtan Bastani 5fc83fad29
macro processor: introduce integer casts 2019-08-02 14:53:24 -04:00
Houtan Bastani 4a3423f74f
macro processor: fix typos 2019-08-02 14:34:50 -04:00
Houtan Bastani b286bedbb6
onlymodel now prints shock_groups block 2019-07-22 15:18:01 -06:00
Houtan Bastani 2c8d0471a4
normalizeEquation not implemented for PacExpectationNodes 2019-07-15 16:34:54 -04:00
Houtan Bastani 866e4d6d39
macro processor: introduce colon operator with three args
This introduces a shift/reduce compilation warning in the macro processor because at expr COLON expr . COLON expr the parser doesn’t know whether to shift or reduce
2019-07-15 16:29:04 -04:00
Houtan Bastani ae0a91256a
add cubic root to dynare language 2019-07-15 12:18:26 -04:00
Sébastien Villemot deb41a2a8f
Fix comment in previous commit 2019-07-11 18:39:32 +02:00
Sébastien Villemot e7b619c0ef
Fix handling of underflows and overflows in load_params_and_steady_state
Basically revert the change made in 30c205f418,
since it lead to preprocessor crashes (via C++ exceptions).
2019-07-11 18:35:42 +02:00
Sébastien Villemot 0988a1f755
Generated LaTeX files are now under <basename>/latex/ 2019-07-11 17:33:53 +02:00