From 1b403276396aa52b7b243470dce2bb7f62677027 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 26 Nov 2020 14:53:28 +0100
Subject: [PATCH] =?UTF-8?q?Remove=20obsolete=20=E2=80=9Crestrictions?=
 =?UTF-8?q?=E2=80=9D=20block?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/ComputingTasks.cc | 172 ------------------------------------------
 src/ComputingTasks.hh |  27 -------
 src/DynareBison.yy    |  86 +--------------------
 src/DynareFlex.ll     |   3 -
 src/ParsingDriver.cc  | 124 ------------------------------
 src/ParsingDriver.hh  |  33 --------
 6 files changed, 2 insertions(+), 443 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index e955c9bf..99dff62f 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -435,178 +435,6 @@ VarEstimationStatement::writeOutput(ostream &output, const string &basename, boo
   output << "oo_ = var_estimation(M_, options_, oo_);" << endl;
 }
 
-VarRestrictionsStatement::VarRestrictionsStatement(string var_model_name_arg,
-                                                   map<string, vector<string>> var_map_arg,
-                                                   map<int, map<int, SymbolList>> exclusion_restrictions_arg,
-                                                   equation_restrictions_t equation_restrictions_arg,
-                                                   crossequation_restrictions_t crossequation_restrictions_arg,
-                                                   map<pair<int, int>, double> covariance_number_restriction_arg,
-                                                   map<pair<int, int>, pair<int, int>> covariance_pair_restriction_arg,
-                                                   const SymbolTable &symbol_table_arg) :
-  var_model_name{move(var_model_name_arg)},
-  var_map{move(var_map_arg)},
-  exclusion_restrictions{move(exclusion_restrictions_arg)},
-  equation_restrictions{move(equation_restrictions_arg)},
-  crossequation_restrictions{move(crossequation_restrictions_arg)},
-  covariance_number_restriction{move(covariance_number_restriction_arg)},
-  covariance_pair_restriction{move(covariance_pair_restriction_arg)},
-  symbol_table{symbol_table_arg}
-{
-}
-
-int
-VarRestrictionsStatement::findIdxInVector(const vector<string> &vecvars, const string &var) const
-{
-  int idx = 0;
-  bool setflag = false;
-  for (auto itvs = vecvars.begin(); itvs != vecvars.end(); ++itvs, idx++)
-    if (*itvs == var)
-      {
-        setflag = true;
-        break;
-      }
-
-  if (!setflag)
-    {
-      cerr << "ERROR: you are imposing an exclusion restriction on an equation or variable "
-           << var << " that is not contained in VAR " << var_model_name;
-      exit(EXIT_FAILURE);
-    }
-  return idx;
-}
-
-void
-VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
-{
-  auto itvs = var_map.find(var_model_name);
-  if (itvs == var_map.end())
-    {
-      cerr << "ERROR: you are imposing restrictions on a VAR named " << var_model_name
-           << " but this VAR has not been declared via the var_model statement." << endl;
-      exit(EXIT_FAILURE);
-    }
-  vector<string> vars = itvs->second;
-
-  string Mstr("M_.var." + var_model_name + ".restrictions.");
-  int nrestrictions = 0;
-
-  // Exclusion Restrictions
-  int idx = 1;
-  for (auto it = exclusion_restrictions.begin();
-       it != exclusion_restrictions.end(); ++it, idx++)
-    {
-      output << Mstr << "exclusion_restrictions{" << idx<< "}.lag = "
-             << it->first << ";" << endl
-             << Mstr << "exclusion_restrictions{" << idx << "}.restrictions = [";
-      for (auto it1 = it->second.begin(); it1 != it->second.end(); ++it1)
-        {
-          if (it1 != it->second.begin())
-            output << " ";
-
-          output << "struct('eq', " << findIdxInVector(vars, symbol_table.getName(it1->first)) + 1
-                 << ", 'vars', [";
-          vector<string> excvars = it1->second.getSymbols();
-          for (auto &excvar : excvars)
-            output << findIdxInVector(vars, excvar) + 1 << " ";
-          output << "])";
-          nrestrictions += it1->second.getSize();
-        }
-      output << "];" << endl;
-    }
-
-  // Equation Restrictions
-  idx = 1;
-  for (auto it = equation_restrictions.begin();
-       it != equation_restrictions.end(); ++it, idx++, nrestrictions++)
-    {
-      output << Mstr << "equation_restriction{" << idx << "}.eq = '"
-             << symbol_table.getName(it->first) << "';" << endl
-             << Mstr << "equation_restriction{" << idx << "}.val = "
-             << it->second.second << ";" << endl;
-
-      var_restriction_eq_crosseq_t ls = it->second.first.first;
-      output << Mstr << "equation_restriction{" << idx << "}.ls = '"
-             << symbol_table.getName(ls.first.first) << "';" << endl
-             << Mstr << "equation_restriction{" << idx << "}.lslag = "
-             << ls.first.second.second << ";" << endl
-             << Mstr << "equation_restriction{" << idx << "}.lscoeff = ";
-      ls.second->writeOutput(output);
-      output << ";" << endl;
-
-      var_restriction_eq_crosseq_t rs = it->second.first.second;
-      if (rs.first.first >= 0)
-        {
-          output << Mstr << "equation_restriction{" << idx << "}.rs = '"
-                 << symbol_table.getName(rs.first.first) << "';" << endl
-                 << Mstr << "equation_restriction{" << idx << "}.rslag = "
-                 << rs.first.second.second << ";" << endl
-                 << Mstr << "equation_restriction{" << idx << "}.rscoeff = ";
-          rs.second->writeOutput(output);
-          output << ";" << endl;
-        }
-    }
-
-  // Cross Equation Restrictions
-  idx = 1;
-  for (auto it = crossequation_restrictions.begin();
-       it != crossequation_restrictions.end(); ++it, idx++, nrestrictions++)
-    {
-      output << Mstr << "crossequation_restriction{" << idx << "}.val = "
-             << it->second << ";" << endl;
-
-      var_restriction_eq_crosseq_t ls = it->first.first;
-      output << Mstr << "crossequation_restriction{" << idx << "}.lseq = "
-             << findIdxInVector(vars, symbol_table.getName(ls.first.first)) + 1 << ";" << endl
-             << Mstr << "crossequation_restriction{" << idx << "}.lsvar = "
-             << findIdxInVector(vars, symbol_table.getName(ls.first.second.first)) + 1 << ";" << endl
-             << Mstr << "crossequation_restriction{" << idx << "}.lslag = "
-             << ls.first.second.second << ";" << endl
-             << Mstr << "crossequation_restriction{" << idx << "}.lscoeff = ";
-      ls.second->writeOutput(output);
-      output << ";" << endl;
-
-      var_restriction_eq_crosseq_t rs = it->first.second;
-      if (rs.first.first >= 0)
-        {
-          output << Mstr << "crossequation_restriction{" << idx << "}.rseq = "
-                 << findIdxInVector(vars, symbol_table.getName(rs.first.first)) + 1 << ";" << endl
-                 << Mstr << "crossequation_restriction{" << idx << "}.rsvar = "
-                 << findIdxInVector(vars, symbol_table.getName(rs.first.second.first)) + 1 << ";" << endl
-                 << Mstr << "crossequation_restriction{" << idx << "}.rslag = "
-                 << rs.first.second.second << ";" << endl
-                 << Mstr << "crossequation_restriction{" << idx << "}.rscoeff = ";
-          rs.second->writeOutput(output);
-          output << ";" << endl;
-        }
-    }
-
-  // Covariance Const Restrictions
-  idx = 1;
-  for (auto it = covariance_number_restriction.begin();
-       it != covariance_number_restriction.end(); ++it, idx++)
-    output << Mstr << "covariance_const_restriction{" << idx << "}.var1 = '"
-           << symbol_table.getName(it->first.first) << "';" << endl
-           << Mstr << "covariance_const_restriction{" << idx << "}.var2 = '"
-           << symbol_table.getName(it->first.second) << "';" << endl
-           << Mstr << "covariance_const_restriction{" << idx << "}.val = "
-           << it->second << ";" << endl;
-
-  // Covariance Pair Restrictions
-  idx = 1;
-  for (auto it = covariance_pair_restriction.begin();
-       it != covariance_pair_restriction.end(); ++it, idx++)
-    output << Mstr << "covariance_pair_restriction{" << idx << "}.var11 = '"
-           << symbol_table.getName(it->first.first) << "';" << endl
-           << Mstr << "covariance_pair_restriction{" << idx << "}.var12 = '"
-           << symbol_table.getName(it->first.second) << "';" << endl
-           << Mstr << "covariance_pair_restriction{" << idx << "}.var21 = '"
-           << symbol_table.getName(it->second.first) << "';" << endl
-           << Mstr << "covariance_pair_restriction{" << idx << "}.var22 = '"
-           << symbol_table.getName(it->second.second) << "';" << endl;
-
-  output << Mstr << "N = " << nrestrictions << ";" << endl;
-}
-
 StochSimulStatement::StochSimulStatement(SymbolList symbol_list_arg,
                                          OptionsList options_list_arg) :
   symbol_list{move(symbol_list_arg)},
diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh
index f11f22ae..948a9b09 100644
--- a/src/ComputingTasks.hh
+++ b/src/ComputingTasks.hh
@@ -156,33 +156,6 @@ public:
   void writeJsonOutput(ostream &output) const override;
 };
 
-class VarRestrictionsStatement : public Statement
-{
-private:
-  using var_restriction_eq_crosseq_t = pair<pair<int, pair<int, int>>, expr_t>;
-  const string var_model_name;
-  const map<string, vector<string>> var_map;
-  const map<int, map<int, SymbolList>> exclusion_restrictions;
-  using equation_restrictions_t = map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>>;
-  const equation_restrictions_t equation_restrictions;
-  using crossequation_restrictions_t = vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>>;
-  const crossequation_restrictions_t crossequation_restrictions;
-  const map<pair<int, int>, double> covariance_number_restriction;
-  const map<pair<int, int>, pair<int, int>> covariance_pair_restriction;
-  const SymbolTable &symbol_table;
-  int findIdxInVector(const vector<string> &vecvars, const string &var) const;
-public:
-  VarRestrictionsStatement(string var_model_name_arg,
-                           map<string, vector<string>> var_map_arg,
-                           map<int, map<int, SymbolList>> exclusion_restrictions_arg,
-                           equation_restrictions_t equation_restrictions_arg,
-                           crossequation_restrictions_t crossequation_restrictions_arg,
-                           map<pair<int, int>, double> covariance_number_restriction_arg,
-                           map<pair<int, int>, pair<int, int>> covariance_pair_restriction_arg,
-                           const SymbolTable &symbol_table_arg);
-  void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
-};
-
 class VarEstimationStatement : public Statement
 {
 private:
diff --git a/src/DynareBison.yy b/src/DynareBison.yy
index db45945c..ecd3944c 100644
--- a/src/DynareBison.yy
+++ b/src/DynareBison.yy
@@ -121,7 +121,7 @@ class ParsingDriver;
 %token <string> TEX_NAME
 %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
 %token VALUES VAR VAREXO VAREXO_DET VARIABLE VAROBS VAREXOBS PREDETERMINED_VARIABLES VAR_EXPECTATION VAR_EXPECTATION_MODEL PLOT_SHOCK_DECOMPOSITION MODEL_LOCAL_VARIABLE
-%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL CROSSEQUATIONS COVARIANCE WRITE_LATEX_STEADY_STATE_MODEL
+%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL WRITE_LATEX_STEADY_STATE_MODEL
 %token XLS_SHEET XLS_RANGE LMMCP OCCBIN BANDPASS_FILTER COLORMAP VAR_MODEL PAC_MODEL QOQ YOY AOA PAC_EXPECTATION TREND_COMPONENT_MODEL
 %left EQUAL_EQUAL EXCLAMATION_EQUAL
 %left LESS GREATER LESS_EQUAL GREATER_EQUAL
@@ -182,7 +182,7 @@ class ParsingDriver;
 %type <expr_t> equation hand_side
 %type <string> non_negative_number signed_number signed_integer date_str
 %type <string> filename symbol namespace_qualified_filename namespace_qualified_symbol
-%type <string> vec_of_vec_value vec_value_list date_expr number
+%type <string> vec_of_vec_value vec_value_list date_expr
 %type <string> vec_value_1 vec_value signed_inf signed_number_w_inf
 %type <string> range vec_value_w_inf vec_value_1_w_inf
 %type <string> integer_range signed_integer_range
@@ -237,7 +237,6 @@ statement : parameters
           | var_model
           | pac_model
           | trend_component_model
-          | restrictions
           | prior
           | prior_eq
           | subsamples
@@ -446,83 +445,6 @@ var_expectation_model_option : VARIABLE EQUAL symbol
                                { driver.var_expectation_model_discount = $3; }
                              ;
 
-restrictions : RESTRICTIONS '(' symbol ')' ';' { driver.begin_VAR_restrictions(); }
-               restrictions_list END ';' { driver.end_VAR_restrictions($3); }
-             ;
-
-restrictions_list : restrictions_list restriction
-                  | restriction
-                  ;
-
-restriction : EXCLUSION LAG INT_NUMBER ';' restriction_exclusion_equation_list
-              { driver.add_VAR_exclusion_restriction($3); }
-            | RESTRICTION EQUATION '(' symbol ')' restriction_equation_equality ';'
-              { driver.add_VAR_restriction_equation_or_crossequation_final($4); }
-            | RESTRICTION CROSSEQUATIONS restriction_crossequation_equality ';'
-              { driver.add_VAR_restriction_equation_or_crossequation_final(""); }
-            | RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL number ';'
-              { driver.add_VAR_covariance_number_restriction($4, $6, $9); }
-            | RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL '(' symbol COMMA symbol ')' ';'
-              { driver.add_VAR_covariance_pair_restriction($4, $6, $10, $12); }
-            ;
-
-restriction_equation_equality : restriction_equation_equality_side PLUS restriction_equation_equality_side EQUAL number
-                                { driver.add_VAR_restriction_equation_or_crossequation($5); }
-                              | restriction_equation_equality_side MINUS restriction_equation_equality_side EQUAL number
-                                {
-                                  driver.multiply_arg2_by_neg_one();
-                                  driver.add_VAR_restriction_equation_or_crossequation($5);
-                                }
-                              | restriction_equation_equality_side EQUAL number
-                                { driver.add_VAR_restriction_equation_or_crossequation($3); }
-                              ;
-
-restriction_equation_equality_side : coeff_def TIMES expression
-                                     { driver.add_VAR_restriction_eq_or_crosseq($3); }
-                                   | coeff_def DIVIDE expression
-                                     {
-                                       expr_t one = driver.add_non_negative_constant("1");
-                                       driver.add_VAR_restriction_eq_or_crosseq(driver.add_divide(one, $3));
-                                     }
-                                   ;
-
-coeff_def : COEFF '(' symbol COMMA INT_NUMBER ')'
-            { driver.add_VAR_restriction_coeff($3, "", $5); }
-          ;
-
-
-restriction_crossequation_equality : restriction_crossequation_equality_side PLUS restriction_crossequation_equality_side EQUAL number
-                                     { driver.add_VAR_restriction_equation_or_crossequation($5); }
-                                   | restriction_crossequation_equality_side MINUS restriction_crossequation_equality_side EQUAL number
-                                     {
-                                       driver.multiply_arg2_by_neg_one();
-                                       driver.add_VAR_restriction_equation_or_crossequation($5);
-                                     }
-                                   | restriction_crossequation_equality_side EQUAL number
-                                     { driver.add_VAR_restriction_equation_or_crossequation($3); }
-                                   ;
-
-restriction_crossequation_equality_side : coeff_def1 TIMES expression
-                                          { driver.add_VAR_restriction_eq_or_crosseq($3); }
-                                        | coeff_def1 DIVIDE expression
-                                          {
-                                            expr_t one = driver.add_non_negative_constant("1");
-                                            driver.add_VAR_restriction_eq_or_crosseq(driver.add_divide(one, $3));
-                                          }
-                                        ;
-
-coeff_def1 : COEFF '(' symbol COMMA symbol COMMA INT_NUMBER ')'
-             { driver.add_VAR_restriction_coeff($3, $5, $7); }
-           ;
-
-restriction_exclusion_equation_list : restriction_exclusion_equation_list restriction_exclusion_equation
-                                    | restriction_exclusion_equation
-                                    ;
-
-restriction_exclusion_equation : EQUATION '(' symbol ')' symbol_list ';'
-                                 { driver.add_VAR_restriction_exclusion_equation($3); }
-                               ;
-
 var_estimation : VAR_ESTIMATION '(' var_estimation_options_list ')' ';'
                  { driver.run_var_estimation(); }
                ;
@@ -3961,10 +3883,6 @@ symbol : NAME
        | PRIOR
        ;
 
-
-number : INT_NUMBER
-       | FLOAT_NUMBER
-       ;
 %%
 
 void
diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll
index 6d8c7878..4ec3ac08 100644
--- a/src/DynareFlex.ll
+++ b/src/DynareFlex.ll
@@ -221,7 +221,6 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <INITIAL>moment_calibration {BEGIN DYNARE_BLOCK; return token::MOMENT_CALIBRATION;}
 <INITIAL>irf_calibration {BEGIN DYNARE_BLOCK; return token::IRF_CALIBRATION;}
 <INITIAL>ramsey_constraints {BEGIN DYNARE_BLOCK; return token::RAMSEY_CONSTRAINTS;}
-<INITIAL>restrictions {BEGIN DYNARE_BLOCK; return token::RESTRICTIONS;}
 <INITIAL>generate_irfs {BEGIN DYNARE_BLOCK; return token::GENERATE_IRFS;}
 <INITIAL>matched_moments {BEGIN DYNARE_BLOCK; return token::MATCHED_MOMENTS;}
 
@@ -387,8 +386,6 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <DYNARE_STATEMENT>restriction_fname {return token::RESTRICTION_FNAME;}
 <DYNARE_STATEMENT>nlags {return token::NLAGS;}
 <DYNARE_STATEMENT>restrictions {return token::RESTRICTIONS;}
-<DYNARE_BLOCK>crossequations {return token::CROSSEQUATIONS;}
-<DYNARE_BLOCK>covariance {return token::COVARIANCE;}
 <DYNARE_BLOCK>adl {return token::ADL;}
 <DYNARE_STATEMENT,DYNARE_BLOCK>diff {return token::DIFF;}
 <DYNARE_STATEMENT>cross_restrictions {return token::CROSS_RESTRICTIONS;}
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index 50726028..d262f8dc 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -470,129 +470,6 @@ ParsingDriver::end_nonstationary_var(bool log_deflator, expr_t deflator)
   reset_data_tree();
 }
 
-void
-ParsingDriver::begin_VAR_restrictions()
-{
-  clear_VAR_storage();
-}
-
-void
-ParsingDriver::end_VAR_restrictions(const string &var_model_name)
-{
-  mod_file->addStatement(make_unique<VarRestrictionsStatement>(var_model_name,
-                                                               var_map,
-                                                               exclusion_restrictions,
-                                                               equation_restrictions,
-                                                               crossequation_restrictions,
-                                                               covariance_number_restriction,
-                                                               covariance_pair_restriction,
-                                                               mod_file->symbol_table));
-  clear_VAR_storage();
-}
-
-void
-ParsingDriver::clear_VAR_storage()
-{
-  exclusion_restriction.clear();
-  exclusion_restrictions.clear();
-  symbol_list.clear();
-  var_restriction_eq_or_crosseq.clear();
-  equation_restrictions.clear();
-  crossequation_restrictions.clear();
-  covariance_number_restriction.clear();
-  covariance_pair_restriction.clear();
-}
-
-void
-ParsingDriver::add_VAR_exclusion_restriction(const string &lagstr)
-{
-  int lag = stoi(lagstr);
-  if (auto it = exclusion_restrictions.find(lag);
-      it == exclusion_restrictions.end())
-    exclusion_restrictions[lag] = exclusion_restriction;
-  else
-    for (auto &it1 : exclusion_restriction)
-      it->second[it1.first] = it1.second;
-
-  exclusion_restriction.clear();
-}
-
-void
-ParsingDriver::add_VAR_restriction_coeff(const string &name1, const string &name2, const string &lagstr)
-{
-  int symb_id1 = mod_file->symbol_table.getID(name1);
-  int symb_id2 = name2.empty() ? -1 : mod_file->symbol_table.getID(name2);
-  int lag = stoi(lagstr);
-
-  var_restriction_coeff = { symb_id1, { symb_id2, lag } };
-}
-
-void
-ParsingDriver::add_VAR_restriction_eq_or_crosseq(expr_t expr)
-{
-  var_restriction_eq_or_crosseq.emplace_back(var_restriction_coeff, expr);
-}
-
-void
-ParsingDriver::add_VAR_restriction_equation_or_crossequation(const string &numberstr)
-{
-  assert(var_restriction_eq_or_crosseq.size() > 0 && var_restriction_eq_or_crosseq.size() < 3);
-  double number = stod(numberstr);
-  if (var_restriction_eq_or_crosseq.size() == 1)
-    var_restriction_equation_or_crossequation = { { var_restriction_eq_or_crosseq[0], { { -1, { -1, -1 } }, nullptr } }, number };
-  else
-    var_restriction_equation_or_crossequation = { { var_restriction_eq_or_crosseq[0], var_restriction_eq_or_crosseq[1] }, number };
-  var_restriction_eq_or_crosseq.clear();
-}
-
-void
-ParsingDriver::multiply_arg2_by_neg_one()
-{
-  assert(var_restriction_eq_or_crosseq.size() == 2);
-  expr_t exprtm1 = add_times(var_restriction_eq_or_crosseq[1].second,
-                             add_uminus(add_non_negative_constant("-1")));
-  var_restriction_eq_or_crosseq[1] = { var_restriction_eq_or_crosseq[1].first, exprtm1 };
-}
-
-void
-ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(const string &name)
-{
-  if (!name.empty())
-    {
-      int symb_id = mod_file->symbol_table.getID(name);
-      equation_restrictions[symb_id] = var_restriction_equation_or_crossequation;
-    }
-  else
-    crossequation_restrictions.push_back(var_restriction_equation_or_crossequation);
-}
-
-void
-ParsingDriver::add_VAR_restriction_exclusion_equation(const string &name)
-{
-  int symb_id = mod_file->symbol_table.getID(name);
-  exclusion_restriction[symb_id] = symbol_list;
-  symbol_list.clear();
-}
-
-void
-ParsingDriver::add_VAR_covariance_number_restriction(const string &name1, const string &name2, const string &valuestr)
-{
-  int symb_id1 = mod_file->symbol_table.getID(name1);
-  int symb_id2 = mod_file->symbol_table.getID(name2);
-  double value = stod(valuestr);
-  covariance_number_restriction[{ symb_id1, symb_id2 }] = value;
-}
-
-void
-ParsingDriver::add_VAR_covariance_pair_restriction(const string &name11, const string &name12, const string &name21, const string &name22)
-{
-  int symb_id11 = mod_file->symbol_table.getID(name11);
-  int symb_id12 = mod_file->symbol_table.getID(name12);
-  int symb_id21 = mod_file->symbol_table.getID(name21);
-  int symb_id22 = mod_file->symbol_table.getID(name22);
-  covariance_pair_restriction[{ symb_id11, symb_id12 }] = { symb_id21, symb_id22 };
-}
-
 void
 ParsingDriver::run_var_estimation()
 {
@@ -1556,7 +1433,6 @@ ParsingDriver::var_model()
   mod_file->var_model_table.addVarModel(name, eqtags, {symbol_list, order});
   symbol_list.clear();
   options_list.clear();
-  var_map[its->second] = symbol_list.getSymbols();
 }
 
 void
diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh
index d2265d02..ea339508 100644
--- a/src/ParsingDriver.hh
+++ b/src/ParsingDriver.hh
@@ -250,9 +250,6 @@ private:
   //! Temporary storage for equation tags
   map<string, string> eq_tags;
 
-  //! Map Var name to variables
-  map<string, vector<string>> var_map;
-
   //! The mod file representation constructed by this ParsingDriver
   unique_ptr<ModFile> mod_file;
 
@@ -268,9 +265,6 @@ private:
   vector<pair<string, string>> model_errors;
   vector<pair<string, string>> undeclared_model_variable_errors;
 
-  //! Used by VAR restrictions
-  void clear_VAR_storage();
-
   //! True when parsing the epilogue block
   bool parsing_epilogue{false};
 
@@ -306,21 +300,6 @@ public:
   //! Temporary storage for the prior shape
   PriorDistributions prior_shape;
 
-  //! VAR restrictions
-  //! > exclusion restrictions
-  map<int, SymbolList> exclusion_restriction;
-  map<int, map<int, SymbolList>> exclusion_restrictions;
-  //! > equation and crossequation restrictions
-  pair<int, pair<int, int>> var_restriction_coeff;
-  using var_restriction_eq_crosseq_t = pair<pair<int, pair<int, int>>, expr_t>;
-  vector<var_restriction_eq_crosseq_t> var_restriction_eq_or_crosseq;
-  pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> var_restriction_equation_or_crossequation;
-  map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>> equation_restrictions;
-  vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>> crossequation_restrictions;
-  //! > covariance restrictions
-  map<pair<int, int>, double> covariance_number_restriction;
-  map<pair<int, int>, pair<int, int>> covariance_pair_restriction;
-
   //! Temporary storage for "expression" option of VAR_EXPECTATION_MODEL
   expr_t var_expectation_model_expression{nullptr};
   //! Temporary storage for discount option of VAR_EXPECTATION_MODEL
@@ -895,18 +874,6 @@ public:
   void perfect_foresight_setup();
   void perfect_foresight_solver();
   void prior_posterior_function(bool prior_func);
-  //! VAR Restrictions
-  void begin_VAR_restrictions();
-  void end_VAR_restrictions(const string &var_model_name);
-  void add_VAR_exclusion_restriction(const string &lagstr);
-  void add_VAR_restriction_exclusion_equation(const string &name);
-  void add_VAR_restriction_coeff(const string &name1, const string &name2, const string &lagstr);
-  void add_VAR_restriction_eq_or_crosseq(expr_t expr);
-  void add_VAR_restriction_equation_or_crossequation(const string &numberstr);
-  void multiply_arg2_by_neg_one();
-  void add_VAR_restriction_equation_or_crossequation_final(const string &name);
-  void add_VAR_covariance_number_restriction(const string &name1, const string &name2, const string &valuestr);
-  void add_VAR_covariance_pair_restriction(const string &name11, const string &name12, const string &name21, const string &name22);
   //! Runs VAR estimation process
   void run_var_estimation();
   //! Method of Moments estimation statement
-- 
GitLab