Yes, nothing jumped out at me as unusual. Reading the generated C code isn't so
clear so I could have missed something. On linux when calc_parser is executing
state->tree is 0x0 which shouldn't happen (gdb). When it exits it is no longer
null but points to invalid memory and hence the segfault. When running under
valgrind it does the same in calc_parser (0x0) but when it exits it points to
the correct location and the AST is printed and evaluated. The equivalent with
a main.c (all that is really Nim here) works as expected.