Search code examples
ctreein-memory-database

Traversing a scheme-like tree (graph) dump using C


I have a Scheme-like tree graph structure. I want to parse it using C into some in-memory representation and walk over it.

It there any library or front-end of parser to do this?

EDIT:

I have parsed the following expression

true && (false || true) ;
true ;
false || false 

into following (This is my scheme-like tree dump)

(PROG [(AndExp TVal(OrExp FValTVal)), TVal, (OrExp FValFVal)])

Which I want to traverse using C ( I have to give it to someone else who only works with C). PROG is a label; AndExp, OrExp etc are tokens for &&, || etc ..


Solution

  • It seems like this is a form of S-Expression. Perhaps This S-Expression Parser can be modified for your needs.