diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index a12702f08b62f4b7648acf4caec353b39b6c2fc0..b51ec5b98fd63cc527f487dc881bb307b0cb068d 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -232,6 +232,60 @@ PerfectForesightSolverStatement::writeJsonOutput(ostream &output) const
   output << "}";
 }
 
+PerfectForesightWithExpectationErrorsSetupStatement::PerfectForesightWithExpectationErrorsSetupStatement(OptionsList options_list_arg) :
+  options_list{move(options_list_arg)}
+{
+}
+
+void
+PerfectForesightWithExpectationErrorsSetupStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
+{
+  options_list.writeOutput(output);
+  output << "perfect_foresight_with_expectation_errors_setup;" << endl;
+}
+
+void
+PerfectForesightWithExpectationErrorsSetupStatement::writeJsonOutput(ostream &output) const
+{
+  output << R"({"statementName": "perfect_foresight_with_expectation_errors_setup")";
+  if (options_list.getNumberOfOptions())
+    {
+      output << ", ";
+      options_list.writeJsonOutput(output);
+    }
+  output << "}";
+}
+
+PerfectForesightWithExpectationErrorsSolverStatement::PerfectForesightWithExpectationErrorsSolverStatement(OptionsList options_list_arg) :
+  options_list(move(options_list_arg))
+{
+}
+
+void
+PerfectForesightWithExpectationErrorsSolverStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
+{
+  mod_file_struct.perfect_foresight_solver_present = true;
+}
+
+void
+PerfectForesightWithExpectationErrorsSolverStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
+{
+  options_list.writeOutput(output);
+  output << "perfect_foresight_with_expectation_errors_solver;" << endl;
+}
+
+void
+PerfectForesightWithExpectationErrorsSolverStatement::writeJsonOutput(ostream &output) const
+{
+  output << R"({"statementName": "perfect_foresight_with_expectation_errors_solver")";
+  if (options_list.getNumberOfOptions())
+    {
+      output << ", ";
+      options_list.writeJsonOutput(output);
+    }
+  output << "}";
+}
+
 PriorPosteriorFunctionStatement::PriorPosteriorFunctionStatement(const bool prior_func_arg,
                                                                  OptionsList options_list_arg) :
   prior_func{prior_func_arg},
diff --git a/src/ComputingTasks.hh b/src/ComputingTasks.hh
index 80cec5420213c4fc2d2ebb307216b56e49ff7a83..26ecc408dcf0198b00a6a163aca34c57fb80e8c7 100644
--- a/src/ComputingTasks.hh
+++ b/src/ComputingTasks.hh
@@ -83,6 +83,27 @@ public:
   void writeJsonOutput(ostream &output) const override;
 };
 
+class PerfectForesightWithExpectationErrorsSetupStatement : public Statement
+{
+private:
+  const OptionsList options_list;
+public:
+  explicit PerfectForesightWithExpectationErrorsSetupStatement(OptionsList options_list_arg);
+  void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
+  void writeJsonOutput(ostream &output) const override;
+};
+
+class PerfectForesightWithExpectationErrorsSolverStatement : public Statement
+{
+private:
+  const OptionsList options_list;
+public:
+  explicit PerfectForesightWithExpectationErrorsSolverStatement(OptionsList options_list_arg);
+  void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override;
+  void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
+  void writeJsonOutput(ostream &output) const override;
+};
+
 class PriorPosteriorFunctionStatement : public Statement
 {
 private:
diff --git a/src/DynareBison.yy b/src/DynareBison.yy
index f4ce61ac70bc7b2f3377107870184044ef5d154e..e85eeade3cd8c56ead17f345f44c8056f979edf5 100644
--- a/src/DynareBison.yy
+++ b/src/DynareBison.yy
@@ -110,6 +110,7 @@ class ParsingDriver;
 %token DETERMINISTIC_TRENDS OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED OUTFILE OUTVARS OVERWRITE DISCOUNT OCCBIN
 %token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PERIOD PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
 %token PERFECT_FORESIGHT_SETUP PERFECT_FORESIGHT_SOLVER NO_POSTERIOR_KERNEL_DENSITY FUNCTION
+%token PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SETUP PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SOLVER
 %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN MLE_MODE PRUNING PARTICLE_FILTER_OPTIONS
 %token <string> QUOTED_STRING
 %token QZ_CRITERIUM QZ_ZERO_THRESHOLD DSGE_VAR DSGE_VARLAG DSGE_PRIOR_WEIGHT TRUNCATE PIPE_E PIPE_X PIPE_P
@@ -166,7 +167,7 @@ class ParsingDriver;
 %token PARAMETER_CONVERGENCE_CRITERION NUMBER_OF_LARGE_PERTURBATIONS NUMBER_OF_SMALL_PERTURBATIONS
 %token NUMBER_OF_POSTERIOR_DRAWS_AFTER_PERTURBATION MAX_NUMBER_OF_STAGES
 %token RANDOM_FUNCTION_CONVERGENCE_CRITERION RANDOM_PARAMETER_CONVERGENCE_CRITERION NO_INIT_ESTIMATION_CHECK_FIRST_OBS
-%token HETEROSKEDASTIC_FILTER TIME_SHIFT STRUCTURAL
+%token HETEROSKEDASTIC_FILTER TIME_SHIFT STRUCTURAL TERMINAL_STEADY_STATE_AS_GUESS_VALUE
 /* Method of Moments */
 %token METHOD_OF_MOMENTS MOM_METHOD
 %token BARTLETT_KERNEL_LAG WEIGHTING_MATRIX WEIGHTING_MATRIX_SCALING_FACTOR ANALYTIC_STANDARD_ERRORS ANALYTIC_JACOBIAN PENALIZED_ESTIMATOR VERBOSE 
@@ -316,6 +317,8 @@ statement : parameters
           | histval_file
           | perfect_foresight_setup
           | perfect_foresight_solver
+          | perfect_foresight_with_expectation_errors_setup
+          | perfect_foresight_with_expectation_errors_solver
           | prior_function
           | posterior_function
           | method_of_moments
@@ -1334,6 +1337,34 @@ perfect_foresight_solver_options : o_stack_solve_algo
                                  | o_print
                                  ;
 
+perfect_foresight_with_expectation_errors_setup : PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SETUP ';'
+                                                  { driver.perfect_foresight_with_expectation_errors_setup(); }
+                                                | PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SETUP '(' perfect_foresight_with_expectation_errors_setup_options_list ')' ';'
+                                                  { driver.perfect_foresight_with_expectation_errors_setup(); }
+                                                ;
+
+perfect_foresight_with_expectation_errors_setup_options_list : perfect_foresight_with_expectation_errors_setup_options_list COMMA perfect_foresight_with_expectation_errors_setup_options
+                                                             | perfect_foresight_with_expectation_errors_setup_options
+                                                             ;
+
+perfect_foresight_with_expectation_errors_setup_options : o_periods
+                                                        | o_datafile
+                                                        ;
+
+perfect_foresight_with_expectation_errors_solver : PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SOLVER ';'
+                                                  { driver.perfect_foresight_with_expectation_errors_solver(); }
+                                                 | PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SOLVER '(' perfect_foresight_with_expectation_errors_solver_options_list ')' ';'
+                                                  { driver.perfect_foresight_with_expectation_errors_solver(); }
+                                                 ;
+
+perfect_foresight_with_expectation_errors_solver_options_list : perfect_foresight_with_expectation_errors_solver_options_list COMMA perfect_foresight_solver_options
+                                                              | perfect_foresight_with_expectation_errors_solver_options
+                                                              ;
+
+perfect_foresight_with_expectation_errors_solver_options : o_pfwee_terminal_steady_state_as_guess_value
+                                                         | perfect_foresight_solver_options
+                                                         ;
+
 method_of_moments : METHOD_OF_MOMENTS ';'
                     { driver.method_of_moments(); }
                   | METHOD_OF_MOMENTS '(' method_of_moments_options_list ')' ';'
@@ -3798,6 +3829,7 @@ o_colormap : COLORMAP EQUAL symbol { driver.option_num("plot_shock_decomp.colorm
 o_icd_colormap : COLORMAP EQUAL symbol { driver.option_num("initial_condition_decomp.colormap",$3); };
 o_no_init_estimation_check_first_obs : NO_INIT_ESTIMATION_CHECK_FIRST_OBS { driver.option_num("no_init_estimation_check_first_obs", "true"); };
 o_heteroskedastic_filter : HETEROSKEDASTIC_FILTER { driver.option_num("heteroskedastic_filter", "true"); };
+o_pfwee_terminal_steady_state_as_guess_value : TERMINAL_STEADY_STATE_AS_GUESS_VALUE { driver.option_num("pfwee.terminal_steady_state_as_guess_value", "true"); };
 
 // Some options to "method_of_moments"
 o_bartlett_kernel_lag : BARTLETT_KERNEL_LAG EQUAL INT_NUMBER { driver.option_num("mom.bartlett_kernel_lag", $3); };
diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll
index 180b691973982e5b4b46c0f50c65fc184a6ea3e7..1ebb669fff4d2882be01ec474f7e2939126e1461 100644
--- a/src/DynareFlex.ll
+++ b/src/DynareFlex.ll
@@ -185,6 +185,8 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <INITIAL>smoother2histval {BEGIN DYNARE_STATEMENT; return token::SMOOTHER2HISTVAL;}
 <INITIAL>perfect_foresight_setup {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_SETUP;}
 <INITIAL>perfect_foresight_solver {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_SOLVER;}
+<INITIAL>perfect_foresight_with_expectation_errors_setup {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SETUP;}
+<INITIAL>perfect_foresight_with_expectation_errors_solver {BEGIN DYNARE_STATEMENT; return token::PERFECT_FORESIGHT_WITH_EXPECTATION_ERRORS_SOLVER;}
 <INITIAL>compilation_setup {BEGIN DYNARE_STATEMENT; return token::COMPILATION_SETUP;}
 
 <DYNARE_STATEMENT>; {
@@ -797,6 +799,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <DYNARE_STATEMENT>irf_plot_threshold {return token::IRF_PLOT_THRESHOLD;}
 <DYNARE_STATEMENT>no_homotopy {return token::NO_HOMOTOPY;}
 <DYNARE_STATEMENT>particle_filter_options {return token::PARTICLE_FILTER_OPTIONS;}
+<DYNARE_STATEMENT>terminal_steady_state_as_guess_value {return token::TERMINAL_STEADY_STATE_AS_GUESS_VALUE;}
 
 <DYNARE_BLOCK>stderr_multiples {return token::STDERR_MULTIPLES;}
 <DYNARE_BLOCK>diagonal_only {return token::DIAGONAL_ONLY;}
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index bd156cd2304d27e1f6bcd0c98092bf427e594d3a..49656a4c433c57aa341e30c10c5263afe6c4819b 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -3186,6 +3186,20 @@ ParsingDriver::perfect_foresight_solver()
   options_list.clear();
 }
 
+void
+ParsingDriver::perfect_foresight_with_expectation_errors_setup()
+{
+  mod_file->addStatement(make_unique<PerfectForesightWithExpectationErrorsSetupStatement>(options_list));
+  options_list.clear();
+}
+
+void
+ParsingDriver::perfect_foresight_with_expectation_errors_solver()
+{
+  mod_file->addStatement(make_unique<PerfectForesightWithExpectationErrorsSolverStatement>(options_list));
+  options_list.clear();
+}
+
 void
 ParsingDriver::method_of_moments()
 {
diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh
index 74b66f09b7cdb1b5751cd4419fbd0e615c2fa0b7..cc6fb43316664fa82646b39dfe199d7744c5de56 100644
--- a/src/ParsingDriver.hh
+++ b/src/ParsingDriver.hh
@@ -863,6 +863,8 @@ public:
   void histval_file();
   void perfect_foresight_setup();
   void perfect_foresight_solver();
+  void perfect_foresight_with_expectation_errors_setup();
+  void perfect_foresight_with_expectation_errors_solver();
   void prior_posterior_function(bool prior_func);
   //! Method of Moments estimation statement
   void method_of_moments();
diff --git a/src/Statement.hh b/src/Statement.hh
index 8c00dc51c8e6ed1aeecc6d482ba26ff658ac9658..32e020a8b196af042192fe82ad45c3b57b4c4f17 100644
--- a/src/Statement.hh
+++ b/src/Statement.hh
@@ -36,7 +36,7 @@ public:
   bool check_present{false};
   //! Whether steady is present
   bool steady_present{false};
-  //! Whether a perfect_foresight_solver/simul statement is present
+  //! Whether a perfect_foresight_solver/simul/perfect_foresight_with_expectation_errors_solver statement is present
   bool perfect_foresight_solver_present{false};
   //! Whether a stoch_simul statement is present
   bool stoch_simul_present{false};