dbd@THEORY.BCHS.UH.EDU (Dan Davison) (08/11/90)
As best I can interpret the new feature table, there appears to be a few
major problems. Is the attached grammar wrong? Why are there so many
reduce/reduce conflicts? It obviously won't fly in this state.
Any help would be appreciated.
dan
(bison is the Gnu version of yacc)
State 29 contains 1 shift/reduce conflict.
State 59 contains 1 shift/reduce conflict.
State 60 contains 1 shift/reduce conflict.
State 61 contains 1 shift/reduce conflict.
State 64 contains 1 shift/reduce conflict.
State 67 contains 7 reduce/reduce conflicts. <---****
State 68 contains 7 reduce/reduce conflicts. <---****
State 70 contains 1 shift/reduce conflict.
State 77 contains 3 reduce/reduce conflicts. <---****
State 85 contains 1 shift/reduce conflict.
State 88 contains 1 shift/reduce conflict.
/* bison grammar for genbank feature tables */
%{
#define YYSTYPE double
#define YYDEBUG
#include <stdio.h>
#include <math.h>
%}
%token SYMBOL
%token INTEGER
%token ELLIPSE
%token DOUBLE_COLON
%token COMPLEMENT
%token JOIN
%token ORDER
%token GROUP
%token ONE_OF
%token REPLACE
%token TEXT_STRING
%token HEADER_1
%token HEADER_2
%% /* grammer rules and actions follow */
feature_table: feature_table_header feature_table_body
;
feature_table_header: HEADER_1
| HEADER_2
;
feature_table_body: feature
| feature_table_body feature
;
feature: feature_key feature_details
;
feature_key: SYMBOL
| '-'
;
feature_details: location qualifier_list
| location
;
location: absolute_location
| feature_name
| '"' literal_sequence '"'
| functional_operator '(' location_list ')'
;
absolute_location: local_location
| path ':' local_location
;
feature_name: path ':' feature_label
| feature_label
;
literal_sequence: SYMBOL
;
functional_operator: | COMPLEMENT
| JOIN
| ORDER
| GROUP
| ONE_OF
| REPLACE
;
location_list: location
| location_list ',' location
;
local_location: base_position
| between_position
| base_range
;
path: database DOUBLE_COLON primary_accession
| primary_accession
;
feature_label: SYMBOL
;
base_position: INTEGER
| low_base_bound
| high_base_bound
| two_base_bound
;
between_position: base_position '^' base_position
;
base_range: base_position ELLIPSE base_position
;
database: SYMBOL
;
primary_accession: SYMBOL
;
low_base_bound: '>' INTEGER
;
high_base_bound: '<' INTEGER
;
two_base_bound: base_position '.' base_position
;
qualifier_list: qualifier
| qualifier_list qualifier
;
qualifier: '/' qualifier_name
| '/' qualifier_name '=' value
;
qualifier_name: SYMBOL
;
value: simple_value
| '(' value_list ')'
| '(' tagged_value_list ')'
;
simple_value: INTEGER
| location
| reference_number
| '"' TEXT_STRING '"'
| SYMBOL
;
value_list: value
| value_list '.' value
;
tagged_value_list: tagged_value
| tagged_value_list ',' tagged_value
;
tagged_value: tag ':' value
;
tag: SYMBOL
;
reference_number: INTEGER
;
%%
yyerror (s)
char *s;
{
printf ("%s\n", s);
}