bison - Shift/Reduce conflict in Bision -


this how grammar looks right now

grammar  0 $accept: program $end  1 program: class_list  2 class_list: class 3           | class_list class  4 class: class typeid '{' feature_list '}' ';' 5      | class typeid inherits typeid '{' feature_list '}' ';'  6 feature_list: /* empty */ 7             | feature 8             | feature_list feature  9 feature: objectid '(' formal_list ')' ':' typeid '{' expr '}' ';' 10        | objectid ':' typeid 11        | objectid ':' typeid assign expr  12 formal_list: /* empty */ 13            | formal 14            | formal_list ',' formal  15 formal: objectid ':' typeid  16 expr: /* empty */ 

and getting shift reduce @ state 9 , 14. can explain shift reduce conflict is?

one problem ambiguity of feature_list. single feature feature_list (production 7) or empty feature_list (6) followed feature (8)?

the definition of formal_list accept unexpected strings (such list starting comma).

in first case, remove production 7. formal_list, define optional_formal_list empty or formal_list , remove empty production formal_list.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -