Tree-like construction while parsing the input file

2009-01-10 Thread Ilyes Gouta
Hi, I'm writing a simple C header file parser using bison and I would like to build a tree structure (a simplified AST) which will hold all the elements of a given .h file. Here is a snippet of my grammar: input: | declaration input ; item_list: | item_declaration item_list ; enum_item:

Re: Tree-like construction while parsing the input file

2009-01-10 Thread Hans Aberg
On 10 Jan 2009, at 16:41, Ilyes Gouta wrote: Here is a snippet of my grammar: input: | declaration input ; item_list: | item_declaration item_list ; enum_item: id { add_node_item(handle, &$1); } | id '=' expr { add_node_item(handle, &$1); } ; declaration: