[antlr-interest] Accessing a return value ...
Ric Klaren
klaren at cs.utwente.nl
Thu May 27 07:51:53 PDT 2004
On Thu, May 27, 2004 at 03:43:24PM +0100, Anthony Youngman wrote:
> But how do I access that value in the programst rule ... that's where I
> want to use it and I haven't got a clue how to get at it ...
programst { int val = 0; } :
#(PROGRAM (IDENT)? statement_list END)
| #(SUBROUTINE (IDENT)? (val=formalargs)? statement_list END)
| #(FUNCTION (IDENT)? (val=formalargs)? statement_list END)
{
// do stuff with val...
}
;
Notice the 'val=formalargs' in the above... Just plain old assignment, only
caveat is getting the order right if you also use a label then it becomes:
val=lbl:formal_args
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755 ----
-----+++++*****************************************************+++++++++-------
Human beings, who are almost unique in having the ability to learn
from the experience of others, are also remarkable for their apparent
disinclination to do so. --- Douglas Adams, Last Chance to See
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list