Bison 2.5 compatibility patch and make target.

This commit is contained in:
Stefano Sanfilippo 2014-11-29 11:11:43 +01:00
parent b312a2fb01
commit 30113be459
3 changed files with 46 additions and 1 deletions

View File

@ -19,6 +19,8 @@
default: compile cleanautogen default: compile cleanautogen
bison2: patch2 default unpatch2
compile: compile:
bison Monicelli.ypp bison Monicelli.ypp
flex Monicelli.lpp flex Monicelli.lpp
@ -26,6 +28,13 @@ compile:
-Wall -Wno-deprecated-register -std=c++11 -DYYDEBUG=0 -O2 \ -Wall -Wno-deprecated-register -std=c++11 -DYYDEBUG=0 -O2 \
Parser.cpp lex.yy.cc Nodes.cpp main.cpp -o mcc Parser.cpp lex.yy.cc Nodes.cpp main.cpp -o mcc
patch2:
# Bison 2 compatibility patch
patch -r - -p 1 -N < bison2.patch || true
unpatch2:
patch -p 1 -R < bison2.patch
graph: graph:
bison --graph Monicelli.y bison --graph Monicelli.y

View File

@ -17,7 +17,15 @@ executable is a matter of:
make make
there are some other targets, which are of interest only for developers. A patch is provided for compatibility with Bison 2.5. If you can't really
upgrade to Bison 3.0, and I strongly recommend that, you can always compile
with:
make bison2
However, note that this is not supported and might be removed in a future release.
There are some other targets, which are of interest only for developers.
Usage Usage
===== =====

28
bison2.patch Normal file
View File

@ -0,0 +1,28 @@
diff --git a/Monicelli.ypp b/Monicelli.ypp
index 028506d..9817f1e 100644
--- a/Monicelli.ypp
+++ b/Monicelli.ypp
@@ -23,7 +23,7 @@
}
%skeleton "lalr1.cc"
-%require "3.0"
+%require "2.5"
%language "c++"
%defines
@@ -31,9 +31,11 @@
%locations
%token-table
-%define parse.error verbose
-%define api.namespace {monicelli}
-%define parser_class_name {Parser}
+%{
+#define YYERROR_VERBOSE
+%}
+%define namespace monicelli
+%define parser_class_name Parser
%lex-param {Scanner &scanner}
%parse-param {Scanner &scanner}