parser.y is not compatible with bison 3.0

Bug #1227047 reported by Alexey Stukalov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zorba
New
Undecided
Unassigned

Bug Description

When building zorba 2.9.1 with bison 3.0, it fails with the following errors and warnings during parser generation:

Generating compiler/parser/xquery_parser.cpp, compiler/parser/xquery_parser.hpp, compiler/parser/location.hh, compiler/parser/position.hh, compiler/parser/stack.hh
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/runtime/visitors/printer_visitor.h
/tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:120.1-13: warning: deprecated directive, use ‘%name-prefix’ [-Wdeprecated]
 %name-prefix="zorba"
 ^^^^^^^^^^^^^
[ 29%] [ 29%] Generating compiler/parser/jsoniq_parser.cpp, compiler/parser/jsoniq_parser.hpp, compiler/parser/location.hh, compiler/parser/position.hh, compiler/parser/stack.hh
Generating compiler/parser/xquery_scanner.cpp
/tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/jsoniq_parser.y:120.1-13: warning: deprecated directive, use ‘%name-prefix’ [-Wdeprecated]
 %name-prefix="zorba"
 ^^^^^^^^^^^^^
[ 29%] Generating compiler/parser/jsoniq_scanner.cpp
[ 29%] Generating diagnostics/diagnostic_list.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/diagnostics/diagnostic_list.cpp
[ 29%] Generating functions/func_accessors.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_accessors.cpp
/tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:124.9-27: warning: %define variable 'parser_class_name' requires '{...}' values [-Wdeprecated]
 %define "parser_class_name" "xquery_parser"
         ^^^^^^^^^^^^^^^^^^^
[ 29%] Generating functions/func_any_uri.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_any_uri.cpp
[ 30%] Generating functions/func_base64.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_base64.cpp
[ 30%] /tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/jsoniq_parser.y:124.9-27: warning: %define variable 'parser_class_name' requires '{...}' values [-Wdeprecated]
 %define "parser_class_name" "jsoniq_parser"
         ^^^^^^^^^^^^^^^^^^^
Generating functions/func_booleans.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_booleans.cpp
[ 30%] Generating functions/func_collections.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_collections.cpp
[ 30%] Generating functions/func_context.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_context.cpp
[ 30%] Generating functions/func_datetime.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_datetime.cpp
[ 30%] Generating functions/func_debug_iterator.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_debug_iterator.cpp
[ 30%] Generating functions/func_durations_dates_times.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_durations_dates_times.cpp
[ 30%] Generating functions/func_errors_and_diagnostics.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_errors_and_diagnostics.cpp
[ 30%] Generating functions/func_other_diagnostics.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_other_diagnostics.cpp
[ 30%] Generating functions/func_fetch.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_fetch.cpp
[ 30%] Generating functions/func_fnput.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_fnput.cpp
/tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:121.1-12: error: %define variable 'api.pure' is not used
 %pure-parser
 ^^^^^^^^^^^^
make[2]: *** [src/compiler/parser/xquery_parser.cpp] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 31%] Generating functions/func_ft_module.cpp
-- Copying pregenerated file for /tmp/zorba/src/zorba-2.9.1/build/src/functions/func_ft_module.cpp
/tmp/zorba/src/zorba-2.9.1/build/src/compiler/parser/jsoniq_parser.y:121.1-12: error: %define variable 'api.pure' is not used
 %pure-parser
 ^^^^^^^^^^^^
make[2]: *** [src/compiler/parser/jsoniq_parser.cpp] Error 1
make[1]: *** [src/CMakeFiles/zorba_simplestore.dir/all] Error 2
make: *** [all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

%pure-parser is not required since it's a C++ one, there is also some deprecated syntax used that causes problems.
When this is fixed, building fails again during C++ compilation of the generated parsers:

/home/astukalov/build/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:3771:20: error: ‘yylval’ was not declared in this scope
             delete yylval.decval;
                    ^
/home/astukalov/build/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:3778:20: error: ‘yylval’ was not declared in this scope
             delete yylval.ival;
                    ^
/home/astukalov/build/zorba/src/zorba-2.9.1/build/src/compiler/parser/xquery_parser.y:3785:20: error: ‘yylval’ was not declared in this scope
             delete yylval.dval;
                    ^

I'm not an expert user, but I guess this is because the deprecated macro yylval was dropped and yylhs.value should be used instead.

Attached is the patch that fixes these issues. It was tested with bison 3.0, but not with the older bison version.

Revision history for this message
Alexey Stukalov (astukalov) wrote :
Revision history for this message
Christoph Lange (math-semantic-web) wrote :

The same patch also helped me on Cygwin, using Bison 3.0.4.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.