Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:59:13+00:00 2026-05-30T13:59:13+00:00

The error message: bison -vdy tjc.y conflicts: 2 shift/reduce tjc.y:72.26-29: warning: rule useless in

  • 0

The error message:

bison -vdy tjc.y
conflicts: 2 shift/reduce
tjc.y:72.26-29: warning: rule useless in parser due to conflicts: return_type: type

EDIT 2: Further reduced the grammar to only the following rules. Same error due to same conflict. If I remove field_decl in the rules then the conflict goes away.

member_decl:      field_decl |  method_decl;

field_decl: STATIC type IDENT EQ SEMI;

method_decl:      STATIC return_type IDENT LPAR RPAR;

type:             INT | FLOAT;

return_type:      type | VOID;

Here’s the section with the shift/reduce conflict in y.output:

state 18

7 field_decl: STATIC type . IDENT EQ SEMI
14 return_type: type .

IDENT  shift, and go to state 23

IDENT  [reduce using rule 14 (return_type)]

Please help me see what’s going wrong here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:59:15+00:00Added an answer on May 30, 2026 at 1:59 pm

    I think Perry‘s analysis of why you have problems is correct.

    I was able to get similar warnings with this complete grammar (identical to yours, but with %token rules in place so I can compile it):

    %token STATIC IDENT FLOAT INT VOID LPAR RPAR EQ SEMI
    
    %%
    member_decl:    field_decl |  method_decl;
    field_decl:     STATIC type IDENT EQ SEMI;
    method_decl:    STATIC return_type IDENT LPAR RPAR;
    type:           INT | FLOAT;
    return_type:    type | VOID;
    %%
    

    Given the analysis, the way I would probably fix it is this:

    %token STATIC IDENT FLOAT INT VOID LPAR RPAR EQ SEMI
    
    %%
    member_decl:    field_decl |  method_decl;
    field_decl:     STATIC type IDENT EQ SEMI;
    method_decl:    STATIC type IDENT LPAR RPAR;
    type:           INT | FLOAT | VOID;
    %%
    

    This compiles without any error in Bison. You just need to add a semantic check in the processing for field_decl that ensures that the relevant type ($2) is not VOID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bison on windows does not produce an output file. This is the error message
Parser Error Message: The server tag is not well formed. Source Error: Line 27:
Error message: The type 'GoogleMapProject_Behaviors:ZoomBehavior' was not found. Verify that you are not missing
The error message is The type or namespace name 'T' could not be found.
Parser Error Message: The entry 'SiteSqlServer' has already been added. Source Error: Line 23:
Getting error message Warning: mail() [function.mail]: Failed to connect to mailserver at localhost port
Error message: Warning : SQM1014: Unable to extract function 'dbo.ProductFamilyIndex_EN' from SqlServer. Null or
Compiler Error Message: CS0122: 'Controls_Arcade_StarDisplay.Stars' is inaccessible due to its protection level I've checked
The error message I am getting is: The type arguments for method 'System.Linq.Queryable.Contains(System.Linq.IQueryable, TSource)'
Error message doesn't display on mysql connect failure if( ! $this->remote_connection_id = @mysql_connect($vars['hostname'], $vars['username'],

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.