EconForge / dolo.py

Economic modelling in python
BSD 2-Clause "Simplified" License
98 stars 72 forks source link

Binary comparison operator in transition function definition get EOF error #179

Open sbenthall opened 4 years ago

sbenthall commented 4 years ago

In this attempt to write a Dolang file for the KinkedRConsumer case (see https://github.com/econ-ark/DARKolo/issues/9):

https://gist.github.com/sbenthall/67ac2884eafa8aebd51fc113cd77ae73

There is a parsing error.

Even though according to the Dynare documentation a binary comparison operator will evaluate to 0 or 1 (which believe would make this transition function/model work).

Here is the error:

https://gist.github.com/sbenthall/1a16372ea670b8dd2ad71e2703f885f7

albop commented 4 years ago

In dolang, ** and ^ are equivalent and both denote the exponential operator.

albop commented 4 years ago

What you would need is an indicator function. It does not exist in dolang yet. A starting point would be to try to add it to the python functions that are recognized: https://github.com/EconForge/Dolang.jl/blob/master/dolang/language.py

sbenthall commented 4 years ago

https://github.com/EconForge/Dolang.jl/blob/master/dolang/function_compiler.py#L86