[Top][All Lists]

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

Re: accessing yyval outside lex and yacc

From: Akim Demaille
Subject: Re: accessing yyval outside lex and yacc
Date: 20 Jul 2001 14:11:00 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

>>>>> "Hans" == Hans Aberg <address@hidden> writes:

Hans> As Akim points out, there is currently no pure way of getting
Hans> hold of the $$ value. I think that incorporating such a way was
Hans> up last fall in the bug-bison list. -- Check the archive.

There is!  Use %pure_parser.  But that's more complex, and I see no
real point in using it.  See `Calling Conventions for Pure Parsers',
especially YYPARSE_PARAM.

A good approximation simply consists in a wrapper around yyparse, in
the preamble, or the postamble of your .y:

Constraint *
constraint_parse ()
  Constraint *res = 0
  // Set up yyin
  if (yyparse ())
    return root;
    return NULL;

and keep root static.

reply via email to

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