【发布时间】:2013-12-30 08:51:02
【问题描述】:
http://linuxgazette.net/106/chirico.html 在示例 1 中,结果打印在 example1.y 中,但我想在 main.c 中处理该结果。我该怎么做?
【问题讨论】:
http://linuxgazette.net/106/chirico.html 在示例 1 中,结果打印在 example1.y 中,但我想在 main.c 中处理该结果。我该怎么做?
【问题讨论】:
打印结果是因为输入说program ::= ... { std::cout << ... }。 IE。解析结果由顶级规则处理。
您可能想使用%extra_argument { MyClass *pThis }。然后 Lemon 将向 Parse 添加第 4 个参数,该参数在操作规则中可用作 pThis。
【讨论】: