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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:15:41+00:00 2026-06-12T19:15:41+00:00

I’m building a parser for an asset xchange format. And I’m including the %token-table

  • 0

I’m building a parser for an asset xchange format. And I’m including the %token-table directive in the bison file but, from the flex code I just can’t access the table or the constants associated with it. That is when trying to compile this code:

Frame|FrameTransformMatrix|Mesh|MeshNormals|MeshMaterialList|Material {
    printf("A keyword: %s\n", yytext);
    yylval.charptr_type = yytext;

    int i;
    for (i = 0; i < YYNTOKENS; i++)
    {
        if (yytname[i] != 0
            && yytname[i][0] == '"'
            && !strncmp(yytname[i] + 1, yytext, strlen(yytext))
            && yytname[i][strlen(yytext) + 1] == '"'
            && yytname[i][strlen(yytext) + 2] == 0)
            return i;
    }
}

gcc says both YYNTOKENS and yytname are undeclared. So was the token table finally deprecated and wiped or what’s the deal?

  • 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-12T19:15:43+00:00Added an answer on June 12, 2026 at 7:15 pm

    The Bison 2.6.2 manual says (on p82 in the PDF):

    %token-table [Directive]

    Generate an array of token names in the parser implementation file. The name of the
    array is yytname; yytname[i] is the name of the token whose internal Bison token
    code number is i. The first three elements of yytname correspond to the predefined
    tokens “$end“, “error“, and “$undefined“; after these come the symbols defined in
    the grammar file.

    The name in the table includes all the characters needed to represent the token in
    Bison. For single-character literals and literal strings, this includes the surrounding
    quoting characters and any escape sequences. For example, the Bison single-character
    literal ’+’ corresponds to a three-character name, represented in C as "’+’"; and
    the Bison two-character literal string "\\/" corresponds to a five-character name,
    represented in C as "\"\\\\/\"".

    When you specify %token-table, Bison also generates macro definitions for macros
    YYNTOKENS, YYNNTS, and YYNRULES, and YYNSTATES:

    YYNTOKENS
    The highest token number, plus one.

    YYNNTS The number of nonterminal symbols.

    YYNRULES The number of grammar rules,

    YYNSTATES
    The number of parser states (see Section 5.5 [Parser States], page 104).

    It looks like it is supposed to be there.

    When I tried a trivial grammar, the table was present:

    #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
    /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
       First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
    static const char *const yytname[] =
    {
      "$end", "error", "$undefined", "ABSINTHE", "NESTLING", "$accept",
      "anything", 0
    };
    #endif
    

    Notes: the table is static; if you are trying to access it from outside the file, that will not work.

    There is an earlier stanza in the source:

    /* Enabling the token table.  */
    #ifndef YYTOKEN_TABLE
    # define YYTOKEN_TABLE 1
    #endif
    

    This ensures that the token table is defined.

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

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters

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.