On Sat, 30 Jan 2010, Tom Stellard wrote:

> I am currently using: yytname[yyr1[yyn]] to access the name of the
> rule that each action is associated with.  For example:
> 
> program:        classes { printf("rule: %s\n",yytname[yyr1[yyn]]);}
>                 ;
> 
> Is this the recommended way to do this,

As far as I know, yyr1 is not documented for users, so there's no 
guarantee it will be supported in future versions of Bison.

> or is there a better way?

None that I know of.  Can you tell us a little more about why you need to 
do this?  That is, why doesn't the following suffice for you?

  program:        classes { printf("rule: program\n");}


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to