diff --git a/config_gram.y b/config_gram.y
index 46399564..75fdfef2 100644
--- a/config_gram.y
+++ b/config_gram.y
@@ -18,6 +18,26 @@
  */
 
 /* $Id$ */
+%{
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "config.h"
+#include "lists.h"
+#include "pindefs.h"
+#include "ppi.h"
+#include "pgm.h"
+#include "stk500.h"
+#include "avr.h"
+
+extern char * progname;
+
+int yylex(void);
+int yyerror(char * errmsg);
+
+%}
 
 %token K_READ
 %token K_WRITE
@@ -453,23 +473,6 @@ mem_spec :
 
 %%
 
-#include <string.h>
-#include <math.h>
-
-#include "config.h"
-#include "lists.h"
-#include "pindefs.h"
-#include "ppi.h"
-#include "pgm.h"
-#include "stk500.h"
-#include "avr.h"
-
-extern char * progname;
-
-int yylex(void);
-int yyerror(char * errmsg);
-
-
 #if 0
 static char * vtypestr(int type)
 {