【发布时间】:2015-02-02 17:59:25
【问题描述】:
在 Yacc / Bison 中,我如何知道父规则以便我可以采取相应的措施?
例如:
Module
:ModuleName "=" Functions
Functions
:Functions Function
| Function
Function
: DEF ID ARGS BODY
{
/* here, I would like to identify the parent rule and do something like this*/
if ($parent_rule == "Module") {
/* take some actions */
} else {
/* this means the Function is matched recursively from the Functions rule. */
}
}
【问题讨论】: