1
votes

http://linuxgazette.net/106/chirico.html In example 1 , The result is printed in example1.y but I want to handle that result in main.c . How can I do that?

1

1 Answers

1
votes

The result is printed because the input said program ::= ... { std::cout << ... }. I.e. the result of parsing is processed by the top-level rule.

You might want to use %extra_argument { MyClass *pThis }. Lemon will then add a 4th parameter to Parse which is available in action rules as pThis.