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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:34:44+00:00 2026-06-09T07:34:44+00:00

I want to use Flex and Bison together. I have declared a union in

  • 0

I want to use Flex and Bison together. I have declared a union in the bison definition file that I will use in the lexer. Bison produces a .tab.h file that includes the union declaration (see below). I include this .tab.h file in the lexer definition, but the lexer action:

  yylval.stringptr = yytext;

causes a compiler error:

lexer.l: In function ‘yylex’:
lexer.l:190: error: request for member ‘stringptr’ in something not a structure or union

Here is a snippet of the .tab.h file:

#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{

/* Line 1676 of yacc.c  */
#line 9 "parser.y"

  char * s;
  char * stringptr;
  double d;
  int i;



/* Line 1676 of yacc.c  */
#line 126 "parser.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif

extern YYSTYPE yylval;

Why is yylval not recognized as a structure or union? How should I correct the problem?

PS: I invoked Flex with –bison-bridge

  • 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-09T07:34:46+00:00Added an answer on June 9, 2026 at 7:34 am

    If you use --bison-bridge, then flex creates a scanner that expects yylval as a parameter, rather than a global, AND that parameter is a YYSTYPE * rather than a YYSTYPE. In order to make it work correctly you need to specify %define api.pure in your bison source file (.y), so it will call yylex with the extra argument, rather than declaring (and expecting yylex to use) a global yylval

    So you need to either get rid of the --bison-bridge argument (to use the normal, default, non-reentrant calling conventions between yylex and yyparse), OR you need to add %define api.pure to the .y file, and change your .l code to use yylval-> instead of yylval. everywhere.

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

Sidebar

Related Questions

I have implemented some utility classes in Flex that I want to use in
I have a project for school where we need to use flex and bison.
I'm trying to use flex and bison to create a filter, because I want
I have some high quality recorded sounds that I want to use within a
I want to use FlashBuilder 4.5.1 to build a flex mobile project that lets
Given a lexer definition file, a grammar file (say, postgresql .y , .l flex
I want use a single php file to handle all of my voting requests.
i want use some data from a website with web service. i have a
We have a powerbuilder application and we want use a scanner through this application
These days, I use Flex & Bison generated some codes to develop a SQL-parser

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.