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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:40:42+00:00 2026-05-28T01:40:42+00:00

Parser.h enum { PLUS, MINUS, DIVIDE, MULTIPLY, NUMBER, END } type; int token; /*

  • 0

Parser.h

enum { PLUS, MINUS, DIVIDE, MULTIPLY, NUMBER, END } type;

int token;

/* parsing functions */
void parse_token (void);

Parser.c

void get_token (void)
{       
     token++;   
     parse_token(); /* LINE 11 */
}

void parse_token (void) /* LINE 14 */
{
    if ( strchr ("1234567890.", token) )
        type = NUMBER;

    else if ( strchr ("+", token) )
        type = PLUS;

    else if ( strchr ("-", token) )
        type = MINUS;

    else if ( strchr ("/", token) )
        type = DIVIDE;

    else if ( strchr ("*",token) )
        type = MULTIPLY;

    else if ( token == '\0' )
        type = END;
    else 
        show_error(strcat("Couldn't parse token : ", token));
}

The Errors

parser.c:14:6: warning: conflicting types for ‘parse_token’ [enabled by default]
parser.c:11:2: note: previous implicit declaration of ‘parse_token’ was here
parser.c: In function ‘parse_token’:
parser.c:16:2: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [enabled by default]
/usr/include/string.h:235:14: note: expected ‘int’ but argument is of type ‘char *’
parser.c:17:3: error: ‘type’ undeclared (first use in this function)
parser.c:17:3: note: each undeclared identifier is reported only once for each function it appears in
parser.c:17:10: error: ‘NUMBER’ undeclared (first use in this function)
parser.c:19:2: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [enabled by default]
/usr/include/string.h:235:14: note: expected ‘int’ but argument is of type ‘char *’
parser.c:20:10: error: ‘PLUS’ undeclared (first use in this function)
parser.c:22:2: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [enabled by default]
/usr/include/string.h:235:14: note: expected ‘int’ but argument is of type ‘char *’
parser.c:23:10: error: ‘MINUS’ undeclared (first use in this function)
parser.c:25:2: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [enabled by default]
/usr/include/string.h:235:14: note: expected ‘int’ but argument is of type ‘char *’
parser.c:26:10: error: ‘DIVIDE’ undeclared (first use in this function)
parser.c:28:2: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [enabled by default]
/usr/include/string.h:235:14: note: expected ‘int’ but argument is of type ‘char *’
parser.c:29:10: error: ‘MULTIPLY’ undeclared (first use in this function)
parser.c:32:10: error: ‘END’ undeclared (first use in this function)
parser.c: In function ‘show_error’:
parser.c:40:2: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]

I’m utterly bamboozled. :(.

Any help?

  • 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-28T01:40:43+00:00Added an answer on May 28, 2026 at 1:40 am

    One you get it to compile (by including the header, as Luchian Grigore said), you’ll find that you can’t do strcat() on a constant string.

    The constant string is allocated in read-only memory, and can’t be modified. And even if you could modify it, you would be overwriting other things in memory.

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

Sidebar

Related Questions

In the kaleidoscope parser / AST example at LLVM , the enum is given
I am parsing some enum values from a text file. In order to simplify
I'm trying to make a function that can take an enum type, display all
I have such an enum and a property. public enum Type { Hourly =
I stumbled upon the usage of the plus (+) operator in an enum definition
Parser Error Message: The entry 'SiteSqlServer' has already been added. Source Error: Line 23:
I recently wrote a parser in Python using Ply (it's a python reimplementation of
Does there exist a parser that generates an AST/parse tree at runtime? Kind of
if __name__=='__main__': parser = OptionParser() parser.add_option(-i, --input_file, dest=input_filename, help=Read input from FILE, metavar=FILE) (options,
There is a JavaScript parser at least in C and Java (Mozilla), in JavaScript

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.