This is the part of grammar for my programming language. I am getting shift/reduce conflicts while compiling.
Rule 1: encryption_spec: key_spec
Rule 2: key_spec:
key_spec key_spec_content
| key_spec_content
;
Rule 3: key_spec_content: TOK_PROTECT key_keyowner
|TOK_PROTECT key_keyname
|TOK_PROTECT key_keymethod
|TOK_PROTECT key_pub_key
|TOK_COMMA key_keyowner
|TOK_COMMA key_keyname
|TOK_COMMA key_keymethod
|TOK_COMMA key_pub_key
|encoding
;
I am getting shift/reduce conflict in Rule 1. Can you please suggest me something to modify ?
Your key_spec
rule is malformed. Indeed you have an infinite recursion.
You should change it for something like
key_spec: /* Empty. */
| key_spec key_spec_content
;
EDIT: Remove the %empty
bison extension.