What we call the Bison style is the traditional style of Bison's grammars. Compared to iterative style, it is not straightforward to use grammars written in Bison style in Semantic. Mainly because such grammars are designed to parse the whole input data in one pass, and don't use the iterative parser back-end mechanism (see Iterative style). With Bison style the parser is called once to parse the grammar start nonterminal.
The following example is a snippet of the Bison style Java grammar provided in the Semantic distribution in the file semantic/wisent/java.wy.
%start formal_parameter ... formal_parameter_list : formal_parameter_list COMMA formal_parameter (cons $3 $1) | formal_parameter (list $1) ; formal_parameter : formal_parameter_modifier_opt type variable_declarator_id (EXPANDTAG (VARIABLE-TAG $3 $2 :typemodifiers $1) ) ;
The first consequence is that syntax errors are not automatically handled by Semantic. Thus, it is necessary to explicitly handle them at the grammar level, providing error recovery rules to skip unexpected input data.
The second consequence is that the iterative parser can't do automatic
tag expansion, except for the start nonterminal value. It is
necessary to explicitly expand tags from concerned semantic actions by
calling the grammar macro
EXPANDTAG with a raw tag as
parameter. See also Start nonterminals, for incremental