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 8110221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:40:19+00:00 2026-06-06T01:40:19+00:00

i have to translate this EBNF to bison: <compound-statement> ::= begin [ <statement> (

  • 0

i have to translate this EBNF to bison:

<compound-statement> ::= begin [ <statement> ( ; <statement> )*] end

<statement> ::= 
| <assignment>
| <if-statement>
| <while-statement>
| <proc-func-call>
| <compound-statement>

when i translate assignement, if,while statements and proc_func_ there is no error in bison. However when i type this in bison, translating the compound statement:

compound_statement : BEGINKEY state ENDKEY ;
state : | statement stm ;
stm : | BQUESTIONMARK statement stm ;

there is a reduce/reduce error.

Can someone explain to me, why there is a reduce/reduce error, because it doesnt make sense to me. I would really appreciate it.

Thanks in advance.

  • 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-06-06T01:40:21+00:00Added an answer on June 6, 2026 at 1:40 am

    So you have a Pascal-ish language where the semicolon is a statement separator, not a terminator.

    I assume that BQUESTIONMARK is your token for the semicolon (“;”).

    I think that you will do best with one production that requires the first statement, then another left-recursive production that provides for
    the optional additional statements.

    I may be misreading something, but your grammar allows state to be epsilon (null) as well as stm, and I think that is the source
    of your reduce/reduce error.

    I would tackle the problem like this:

    compound_statement : BEGINKEY first_statement statements ENDKEY
                       | BEGINKEY first_statement ENDKEY
                       ;
    
    first_statement : statement ;
    
    statement : assignment
              | if_statement
              | while_statement
              | proc_func_call
              | compound_statement
              ;
    
    statements : statements statement_with_semi
               | statement_with_semi
               ;
    
    statement_with_semi : BQUESTIONMARK statement ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 Oracle questions How do I translate this SQL Server statement to
I have a lot of difficulties in trying to translate this SQL query to
I have this method which lets me translate the position of an object, animating
I have this link which i need to translate in a php variable. http://www.facebook.com/dialog/apprequests?app_id=346824075388300&to=1149862205&message=Facebook+Dialogs+are+so+easy%21&redirect_uri=http%3A%2F%2Fpenelope-ns.net%2Ffb%2F
As a non-english speaker, I have trouble differentiating this. When I try to translate
I have written an application (wpf - will Mono translate this for a Mac?)
Help me translate this into proper NHibernate... I have an Oracle database with 2
I am pretty new with SQL and i have to translate this ruby script
I have never used ruby but need to translate this code to java. Can
I have to translate this code: <!--[if IE 7]> <link rel=stylesheet type=text/css href=css/ie7-style.css />

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.