[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DotGNU]Treecc / Bison - List rule best pattern
From: |
sergio |
Subject: |
[DotGNU]Treecc / Bison - List rule best pattern |
Date: |
Fri, 30 Jan 2004 15:00:36 -0000 (WET) |
User-agent: |
SquirrelMail/1.4.1 |
Hi:
I hope not being of topic here.
I am currently changing a free Informix 4gl compiler that have code
generation in sematic actions of bison to use an AST. The parser is bison,
the lexer is C++ and all is built to be reentrant.
The main goal with this version is the cleaness, simplicity and
maintainabilty of the code.
I have choosed to use treecc because the code in bison and in .tc will
keep very clear and short.
In some rules, however i do not get a clear and short code.
I want to create a simple optional list (wich is one a very common rule in
the parser).
The tipicall bison code is:
opt_function_list
:
| function_list
;
function_list
: abstract_function
| function_list abstract_function
;
If i make the AST by hand tipically i create a vector in a class called
FunctionList and an AddFunction() method that pushes the new Function into
it.
In treecc i dont know how to do it.
Please someone tell me a simple (keep in mind that the goal is simplicity)
pattern to implement this in my parser ?
Thanks In Advance
Sérgio Ferreira
- [DotGNU]Treecc / Bison - List rule best pattern,
sergio <=