Related articles |
---|
Giving yyparse() args / Yacc state? topper@virginia.edu (David J. Topper) (2001-07-17) |
Re: Giving yyparse() args / Yacc state? joe.hotchkiss@baesystems.com (2001-07-18) |
From: | "David J. Topper" <topper@virginia.edu> |
Newsgroups: | comp.compilers |
Date: | 17 Jul 2001 23:29:49 -0400 |
Organization: | University of Virginia |
Keywords: | yacc, question, comment |
Posted-Date: | 17 Jul 2001 23:29:49 EDT |
Hi folks,
I have a C application with various "objects." Yes, I'm using structs
and whatnot to do the same basic thing as C++. Anyhow, lets say
something like this:
struct obj {
int val1;
int val2;
etc...
}
and I want each object to be able to call yyparse() and have access to
its respective data. So I can have a little parser say things like:
(val1 > val2) | (va1 = val2)
and so on. But I don't want to have to mess with global variables if I
don't have to. One hack would be to reset a global "active_obj" to
point to the currently active object, but I'm wondering if I can set
things up like:
yyparse(obj *)
so that it can get passed in?
Advice / comments / etc ... appreciate. Please cc me via email if it's
not too much trouble.
DT
--
Technical Director - Virginia Center for Computer Music
http://www.virginia.edu/music/vccm.html
[yyparse doesn't take any arguments. It should, but it doesn't. If you
really want it to, you can easily post-edit the generated y.tab.c. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.