diff --git a/preprocessor/DynareMain.cc b/preprocessor/DynareMain.cc
index 1381e789a29a795d272be37a0fa29a91b76ffdeb..36f174931557c93edd599a302a90241f927b8f0a 100644
--- a/preprocessor/DynareMain.cc
+++ b/preprocessor/DynareMain.cc
@@ -32,8 +32,7 @@ using namespace std;
    Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
    included simultaneously (because of Bison limitations).
 */
-void main2(stringstream &in, string &basename, bool trace_scanning, bool trace_parsing,
-           bool clear_all);
+void main2(stringstream &in, string &basename, bool debug, bool clear_all);
 
 int
 main(int argc, char** argv)
@@ -47,17 +46,13 @@ main(int argc, char** argv)
 
   bool clear_all = true;
   bool save_macro = false;
-  bool trace_scanning = false;
-  bool trace_parsing = false;
+  bool debug = false;
 
   // Parse options
   for (int arg = 2; arg < argc; arg++)
     {
       if (string(argv[arg]) == string("debug"))
-        {
-          trace_scanning = true;
-          trace_parsing = true;
-        }
+        debug = true;
       else if (string(argv[arg]) == string("noclearall"))
         clear_all = false;
       else if (string(argv[arg]) == string("savemacro"))
@@ -79,9 +74,8 @@ main(int argc, char** argv)
   basename.erase(basename.size() - 4, 4);
 
   // Do macro processing
-  MacroDriver m;
-  m.trace_scanning = trace_scanning;
-  m.trace_parsing = trace_parsing;
+  MacroDriver m(debug);
+
   stringstream macro_output;
   m.parse(argv[1], macro_output);
   if (save_macro)
@@ -92,7 +86,7 @@ main(int argc, char** argv)
     }
 
   // Do the rest
-  main2(macro_output, basename, trace_scanning, trace_parsing, clear_all);
+  main2(macro_output, basename, debug, clear_all);
 
   return 0;
 }
diff --git a/preprocessor/DynareMain2.cc b/preprocessor/DynareMain2.cc
index 39480cbc5d129a012c0e3ee5f10361933ba6823b..3d2b53a7b2c83d6ca2e9efa98df112faa66e97cc 100644
--- a/preprocessor/DynareMain2.cc
+++ b/preprocessor/DynareMain2.cc
@@ -25,11 +25,9 @@ using namespace std;
 #include "ModFile.hh"
 
 void
-main2(stringstream &in, string &basename, bool trace_scanning, bool trace_parsing, bool clear_all)
+main2(stringstream &in, string &basename, bool debug, bool clear_all)
 {
-  ParsingDriver p;
-  p.trace_scanning = trace_scanning;
-  p.trace_parsing = trace_parsing;
+  ParsingDriver p(debug);
 
   // Do parsing and construct internal representation of mod file
   ModFile *mod_file = p.parse(in);
diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc
index ba145fd36c2c91e6ca7e98df0199134afe9729e6..34a419d4fedcad6e49ba5adae48176128f4cbe86 100644
--- a/preprocessor/ParsingDriver.cc
+++ b/preprocessor/ParsingDriver.cc
@@ -23,7 +23,7 @@
 #include "ParsingDriver.hh"
 #include "Statement.hh"
 
-ParsingDriver::ParsingDriver() : trace_scanning(false), trace_parsing(false)
+ParsingDriver::ParsingDriver(bool debug_arg) : debug(debug_arg)
 {
 }
 
@@ -70,9 +70,10 @@ ParsingDriver::parse(istream &in)
   reset_data_tree();
 
   lexer = new DynareFlex(&in);
-  lexer->set_debug(trace_scanning);
+  lexer->set_debug(debug);
 
   Dynare::parser parser(*this);
+  parser.set_debug_level(debug);
   parser.parse();
 
   delete lexer;
diff --git a/preprocessor/include/ParsingDriver.hh b/preprocessor/include/ParsingDriver.hh
index 2b189ed62855de27a302202220e548eef0938812..c8166dbb6f37700ed6541b17393b6edf966fc3d3 100644
--- a/preprocessor/include/ParsingDriver.hh
+++ b/preprocessor/include/ParsingDriver.hh
@@ -137,9 +137,12 @@ private:
   //! The mod file representation constructed by this ParsingDriver
   ModFile *mod_file;
 
+  //! Output debugging info during scanning and parsing ?
+  const bool debug;
+
 public:
   //! Constructor
-  ParsingDriver();
+  ParsingDriver(bool debug_arg);
   //! Destructor
   virtual ~ParsingDriver();
 
@@ -153,15 +156,6 @@ public:
   //! Copy of parsing location, maintained by YYLLOC_DEFAULT macro in DynareBison.yy
   Dynare::parser::location_type location;
 
-  //! Trace scanning ?
-  /*! If set to true before calling parse(), the flex scanner will dump a lot of debugging information. Defaults to false.
-  */
-  bool trace_scanning;
-
-  //! Trace parsing ?
-  /*! If set to true before calling parse(), the bison parser will dump debugging information. Defaults to false. */
-  bool trace_parsing;
-
   //! Estimation parameters
   EstimationParams estim_params;
 
diff --git a/preprocessor/macro/MacroDriver.cc b/preprocessor/macro/MacroDriver.cc
index 00f46ba0c2854a9056560a32c817d7ee16f87baf..e551dd80e800e5932875d6c034a0bbf28a23e021 100644
--- a/preprocessor/macro/MacroDriver.cc
+++ b/preprocessor/macro/MacroDriver.cc
@@ -22,7 +22,7 @@
 
 #include "MacroDriver.hh"
 
-MacroDriver::MacroDriver() : trace_scanning(false), trace_parsing(false)
+MacroDriver::MacroDriver(bool debug_arg) : debug(debug_arg)
 {
 }
 
@@ -47,9 +47,10 @@ MacroDriver::parse(const string &f, ostream &out)
     }
 
   lexer = new MacroFlex(&in, &out);
-  lexer->set_debug(trace_scanning);
+  lexer->set_debug(debug);
 
   Macro::parser parser(*this, out);
+  parser.set_debug_level(debug);
   parser.parse();
 
   delete lexer;
diff --git a/preprocessor/macro/MacroDriver.hh b/preprocessor/macro/MacroDriver.hh
index 3f00abf27703f61838f873abbd1234813d001097..5a67d1891e23386443f260d2529c90dac72b754d 100644
--- a/preprocessor/macro/MacroDriver.hh
+++ b/preprocessor/macro/MacroDriver.hh
@@ -138,6 +138,9 @@ class MacroDriver
 {
   friend class MacroValue;
 private:
+  //! Output debugging info during scanning and parsing ?
+  const bool debug;
+
   //! Stores all created macro values
   set<const MacroValue *> values;
 
@@ -157,7 +160,7 @@ public:
   };
 
   //! Constructor
-  MacroDriver();
+  MacroDriver(bool debug_arg);
   //! Destructor
   virtual ~MacroDriver();
 
@@ -176,15 +179,6 @@ public:
   //! Used to store the value of the last @if condition
   bool last_if;
 
-  //! Trace scanning ?
-  /*! If set to true before calling parse(), the flex scanner will dump a lot of debugging information. Defaults to false.
-  */
-  bool trace_scanning;
-
-  //! Trace parsing ?
-  /*! If set to true before calling parse(), the bison parser will dump debugging information. Defaults to false. */
-  bool trace_parsing;
-
   //! Error handler
   void error(const Macro::parser::location_type &l, const string &m) const;