help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How is information passed back to a control program for push parsers?


From: Arthur Schwarz
Subject: How is information passed back to a control program for push parsers?
Date: Sat, 14 Dec 2013 14:44:01 -0800 (PST)

Section 3.7.1 page 82

pure parser

---- code ----
    int status;
    yypstate *ps = yypstate_new ();
    do {
        status = yypush_parse (ps, yylex (), NULL);
    } while (status == YYPUSH_MORE);
    82 Bison 3.0
    yypstate_delete (ps);

---- end code ----


It was reported in a bug report that the yypush_parse() calling sequence 
description differs from the example. Even if this is the correct interface it 
can't be used. So, just as below, what is the interface with yylex() and how 
does information between yylex() and yypush_parse() occur? Since this is a 
'pure' parser,, yylval and yylloc can not be global, so what is the correct 
interface? yypstate can not be a vehicle since it is not based to yylex(), and 
it can't be global because that violates independence requirement for 
reentrancy.


impure parser (no doubt can not interface with a unicorn).

---- code ----


    extern int yychar;
    int status;
    yypstate *ps = yypstate_new ();
    do {
       yychar = yylex ();
       status = yypush_parse (ps);
    } while (status == YYPUSH_MORE);
    yypstate_delete (ps);

---- end code ----

And yylex() returns an int. What happened to yylval and yylloc? Is the 
assumption that the example is complete "That’s it." because this example 
doesn't use this data? Shouldn't data tunneling be mentioned to explain how 
information generated in the lexor is now passed to the parser? It is true that 
this is mentioned elsewhere, but so in yyychar?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]