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

  • Home
  • SEARCH
  • 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 8741161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:15:40+00:00 2026-06-13T11:15:40+00:00

I am trying to develop a program which converts infix expression to postfix expression

  • 0

I am trying to develop a program which converts infix expression to postfix expression using lex and yacc tools.

Here is the source code :

(Lex program: ipi.l)

 ALPHA [A-Z a-z]
 DIGIT [0-9]
 %%
 {ALPHA}({ALPHA}|{DIGIT})*    return ID;
 {DIGIT}+                                      {yylval=atoi(yytext); return ID;}
 [\n \t]                                              yyterminate();
 .                                                      return yytext[0];
 %%

(Yacc program: ipi.y)

%{
#include <stdio.h>
#include <stdlib.h>
%}
%token    ID
%left    '+' '-'
%left    '*' '/'
%left    UMINUS

%%

S    :    E
E    :    E'+'{A1();}T{A2();}
     |    E'-'{A1();}T{A2();}
     |    T
     ;
T    :    T'*'{A1();}F{A2();}
     |    T'/'{A1();}F{A2();}
     |    F
     ;
F    :    '('E{A2();}')'
     |    '-'{A1();}F{A2();}
     |    ID{A3();}
     ;

%%

#include "lex.yy.c"
char st[100];
int top=0;

main()
{
 printf("Enter infix expression:  ");
 yyparse();
 printf("\n");
}

A1()
{
  st[top++]=yytext[0];
}

A2()
{
 printf("%c",st[--top]);
}

A3()
{
  printf("%c",yytext[0]);
}

However it is giving the following error :

/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/liby.a(yyerror.o): In function `yyerror':
 (.text+0x1c): undefined reference to `rpl_fprintf'
 collect2: ld returned 1 exit status

Please help me out solving this.
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-13T11:15:41+00:00Added an answer on June 13, 2026 at 11:15 am

    You should provide your own yyerror, like this one:

    void yyerror (char *s) {
        fprintf (stderr, "%s\n", s);
    }
    

    Source:

    http://lists.gnu.org/archive/html/help-bison/2012-01/msg00016.html

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

Sidebar

Related Questions

I'm trying to develop a cross-platform application using C++ with boost. I typically program
I am trying to develop a program wherein which the first screen contains a
I'm trying to develop a simple program which will show a form with a
I'm trying to develop a program that takes requests for data which is stored
I'm to trying to develop a program to transfer files using TCP (in a
I'm currently trying to develop a program which stores lots of data, similar to
I'm trying to develop a program that convert 6 bytes into a hexadecimal representation
I am trying to develop my Hello World program in NHibernate. My codes are
I am trying to develop an application for my localhost on which I can
I was trying to develop a video management software for which I was evaluating

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.