Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
http://linuxgazette.net/106/chirico.html 在示例 1 中,结果打印在 example1.y 中,但我想在 main.c 中处理该结果。我怎样才能做到这一点?
结果被打印,因为输入说program ::= ... { std::cout << ... }. 即解析结果由顶级规则处理。
program ::= ... { std::cout << ... }
您可能想使用%extra_argument { MyClass *pThis }. Lemon 然后将添加第 4 个参数,Parse该参数在操作规则中可用,如pThis.
%extra_argument { MyClass *pThis }
Parse
pThis