diff --git a/src/DynareBison.yy b/src/DynareBison.yy
index 697d8bab30a882f8491e1faf2345f539802e1bf2..c74bc0cc94e61cc4d2eb94ef19b95e3fe140e760 100644
--- a/src/DynareBison.yy
+++ b/src/DynareBison.yy
@@ -184,7 +184,8 @@ class ParsingDriver;
 %type <vector<string>> change_type_var_list
 %type <vector<int>> vec_int_elem vec_int_1 vec_int vec_int_number
 %type <PriorDistributions> prior_pdf prior_distribution
-%type <pair<string,string>> named_var_elem subsamples_eq_opt calibration_range integer_range_w_inf
+%type <pair<expr_t,expr_t>> calibration_range
+%type <pair<string,string>> named_var_elem subsamples_eq_opt integer_range_w_inf
 %type <vector<pair<string,string>>> named_var named_var_1
 %type <tuple<string,string,string,string>> prior_eq_opt options_eq_opt
 %%
@@ -2998,14 +2999,12 @@ model_diagnostics : MODEL_DIAGNOSTICS ';'
                     { driver.model_diagnostics(); }
                   ;
 
-calibration_range : '[' signed_number_w_inf signed_number_w_inf ']'
-                    { $$ = make_pair($2, $3); }
-                  | '[' signed_number_w_inf COMMA signed_number_w_inf ']'
+calibration_range : '[' expression COMMA expression ']'
                     { $$ = make_pair($2, $4); }
                   | PLUS
-                    { $$ = make_pair("0", "inf"); }
+                    { $$ = make_pair(driver.add_non_negative_constant("0"), driver.add_inf_constant()); }
                   | MINUS
-                    { $$ = make_pair("-inf", "0"); }
+                    { $$ = make_pair(driver.add_uminus(driver.add_inf_constant()), driver.add_non_negative_constant("0")); }
                   ;
 
 moment_calibration : MOMENT_CALIBRATION ';' moment_calibration_list END ';'
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index 9aa88789d7f1133387151fbead62b045b7684205..4efbe0cfc69ecfdd110e037602bc2d66e55d8800 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -3205,7 +3205,7 @@ ParsingDriver::add_parallel_local_file(string filename)
 }
 
 void
-ParsingDriver::add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<string, string> &range)
+ParsingDriver::add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<expr_t, expr_t> &range)
 {
   MomentCalibration::Constraint c;
 
@@ -3232,7 +3232,7 @@ ParsingDriver::end_moment_calibration()
 }
 
 void
-ParsingDriver::add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<string, string> &range)
+ParsingDriver::add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<expr_t, expr_t> &range)
 {
   IrfCalibration::Constraint c;
 
diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh
index ed5eef0a2c5786e28396f27c7c902b0e8ed2a903..42572adf8342bdce344907ec28299ca7e7a15a26 100644
--- a/src/ParsingDriver.hh
+++ b/src/ParsingDriver.hh
@@ -845,11 +845,11 @@ public:
   //! Processing the parallel_local_files option
   void add_parallel_local_file(string filename);
   //! Add an item of a moment_calibration statement
-  void add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<string, string> &range);
+  void add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<expr_t, expr_t> &range);
   //! End a moment_calibration statement
   void end_moment_calibration();
   //! Add an item of an irf_calibration statement
-  void add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<string, string> &range);
+  void add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<expr_t, expr_t> &range);
   //! End a moment_calibration statement
   void end_irf_calibration();
   //! Add a shock to a group
diff --git a/src/Shocks.cc b/src/Shocks.cc
index bf0f8684d2628b42f70feb185494acde4581a7ca..366939d6367171d51dd9879b0f481947ae59cd5c 100644
--- a/src/Shocks.cc
+++ b/src/Shocks.cc
@@ -525,7 +525,11 @@ MomentCalibration::writeOutput(ostream &output, const string &basename, bool min
       output << "'" << symbol_table.getName(c.endo1) << "', "
              << "'" << symbol_table.getName(c.endo2) << "', "
              << c.lags << ", "
-             << "[ " << c.lower_bound << ", " << c.upper_bound << " ];"
+             << "[ ";
+      c.lower_bound->writeOutput(output);
+      output << ", ";
+      c.upper_bound->writeOutput(output);
+      output << " ];"
              << endl;
     }
   output << "};" << endl;
@@ -543,8 +547,12 @@ MomentCalibration::writeJsonOutput(ostream &output) const
       output << R"({"endogenous1": ")" << symbol_table.getName(it->endo1) << R"(")"
              << R"(, "endogenous2": ")" << symbol_table.getName(it->endo2) << R"(")"
              << R"(, "lags": ")" << it->lags << R"(")"
-             << R"(, "lower_bound": ")" << it->lower_bound << R"(")"
-             << R"(, "upper_bound": ")" << it->upper_bound << R"(")"
+             << R"(, "lower_bound": ")";
+      it->lower_bound->writeJsonOutput(output, {}, {});
+      output << R"(")"
+             << R"(, "upper_bound": ")";
+      it->upper_bound->writeJsonOutput(output, {}, {});
+      output << R"(")"
              << "}";
     }
   output << "]"
@@ -569,7 +577,11 @@ IrfCalibration::writeOutput(ostream &output, const string &basename, bool minima
       output << "'" << symbol_table.getName(c.endo) << "', "
              << "'" << symbol_table.getName(c.exo) << "', "
              << c.periods << ", "
-             << "[ " << c.lower_bound << ", " << c.upper_bound << " ];"
+             << "[ ";
+      c.lower_bound->writeOutput(output);
+      output << ", ";
+      c.upper_bound->writeOutput(output);
+      output << " ];"
              << endl;
     }
   output << "};" << endl;
@@ -593,8 +605,12 @@ IrfCalibration::writeJsonOutput(ostream &output) const
       output << R"({"endogenous": ")" << symbol_table.getName(it->endo) << R"(")"
              << R"(, "exogenous": ")" << symbol_table.getName(it->exo) << R"(")"
              << R"(, "periods": ")" << it->periods << R"(")"
-             << R"(, "lower_bound": ")" << it->lower_bound << R"(")"
-             << R"(, "upper_bound": ")" << it->upper_bound << R"(")"
+             << R"(, "lower_bound": ")";
+      it->lower_bound->writeJsonOutput(output, {}, {});
+      output << R"(")";
+      output << R"(, "upper_bound": ")";
+      it->upper_bound->writeJsonOutput(output, {}, {});
+      output << R"(")"
              << "}";
     }
   output << "]"
diff --git a/src/Shocks.hh b/src/Shocks.hh
index 48176ff5aa4b43f7cdcbd792a12c094beb0e9f3d..d4caad0a5aec16772a7bf6fe89a9fe1d9c472616 100644
--- a/src/Shocks.hh
+++ b/src/Shocks.hh
@@ -113,7 +113,7 @@ public:
   {
     int endo1, endo2;
     string lags;
-    string lower_bound, upper_bound;
+    expr_t lower_bound, upper_bound;
   };
   using constraints_t = vector<Constraint>;
 private:
@@ -133,7 +133,8 @@ public:
   {
     int endo;
     int exo;
-    string periods, lower_bound, upper_bound;
+    string periods;
+    expr_t lower_bound, upper_bound;
   };
   using constraints_t = vector<Constraint>;
 private: