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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:42:06+00:00 2026-06-13T03:42:06+00:00

modified once more. After removing the recursions, and writing a code for infix expression

  • 0

modified once more. After removing the recursions, and writing a code for infix expression :
it also contains precedence checking, and no recursive grammar and no start Non terminal and also an error message.

%{
#include<stdio.h>
%}

%token ALPHA NUMBER PLUS MINUS MUL DIV LPAR RPAR

%%

expr : expr PLUS term     { printf("its an infix expression");  }
     | expr MINUS term    
     | term 
     ; 

term : term MUL factor
     | term DIV factor
     | factor
     ;


factor : LPAR expr RPAR 
       | NUMBER 
       | ALPHA
       ;
%%
main()
{
yyparse();
}

int yyerror (char *s)
{

    printf("Not an infix expression");
}

is this okay now ?

  • 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-13T03:42:08+00:00Added an answer on June 13, 2026 at 3:42 am

    No it isn’t. Apart from all the conflicts, it doesn’t define any operator precedence. There are plenty of correct examples of LR expression grammars available on the Internet.

    EDIT: Unary minus goes in the missing primary rule. From factor it usually goes like this:

    factor: primary
        | primary '^' factor // exponentiation, note right-recursion for right-associativitity, or use %prec
        ;
    
    primary: '(' expr ')'
        | '-' primary // unary minus; note recursion, to allow any number of them
        | NUMBER
        | IDENTIFIER
        ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Purpose: To make sure some elements couldn't be modified, I disabled some elements once
Modified the code this time the objective to count the line of code was
(I have modified this question to make it more explicit.) I have a dataset
I'm updating some legacy code to more efficiently use .ini files for parameter storage.
Whenever it is invoked on the same object more than once during an execution
From JLS: Whenever it is invoked on the same object more than once during
I modified one method of JQuery UI Resizable to achieve a centered resize. This
I modified an existing form and saved it on my desktop as .oft file.
I modified this simple countdown timer form here: https://github.com/lunaryorn/snippets/blob/master/qt4/countdown.py as follows. Now I want
I modified an example with threads and got the example with multiprocessing included below.

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.