yylval
yylval is a global variable used by the lexical analyzer and parser generated by tools such as Lex/Flex and Yacc/Bison to communicate the semantic value of the currently scanned token. It is of type YYSTYPE, a type defined by the parser (often via a %union declaration in the grammar). Before the parser processes a token, the lexer assigns the appropriate value to yylval and returns the token’s symbolic type.
During parsing, the token’s semantic value is available to the grammar actions through the standard semantic
In practice, implementations usually declare extern YYSTYPE yylval (or define YYSTYPE yylval) for the generated parser.
Relative to modern toolchains, yylval remains the conventional channel for token values, even as parsing modes