Lemon parser - how to handle result from lemon parser

169 views Asked by At

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

There are 1 answers

0
MSalters On

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.