This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
About a new gcc feature. I hope you read this e-mail
- From: "lucas75it at tiscali dot it" <lucas75it at tiscali dot it>
- To: gcc at gcc dot gnu dot org, gcc at gcc dot gnu dot org, rms-assist at gnu dot org
- Date: Fri, 17 Jan 2003 09:12:48 +0100
- Subject: About a new gcc feature. I hope you read this e-mail
First of all: excuse my english, it doesn't work very well !
Two years ago (2000) i studied myself the AST of the gcc.
I learnt its structure, macros, syntax, ... (if you want see
www.unisannio.it/villano/students/masone/)
Now i'am reading your book: "GNU Compiler Collection Internals, for gcc 3.4"
I have a little idea.
We write the C file foo.c and we compile it.
The compiler make the passes:
1 - parsing
2 - tree optmization
3 - RTL generation
4 - Sibiling call optimization
5 - ................
6 - ................
After the first step (parsing) we have the AST of foo.c
Now, can we introduce a new substep that give us the ability of visit
the AST ?
Follow me.
We can introduce a new flag; for example -vast (visit ast).
We can modify the gcc source code in this way: after parsing pass if
vast is on we call a module that visit the AST.
In C we can write:
/* To inttroduce in a gcc source file.
After parsing pass of gcc.
*/
if (flag_vast_is_ON) {
init_ast_walker(....);
launch_ast_walker(....);
destroy_ast_walker(....);
}
We write a module walker.c that implement these functions. We place it
in gcc/walkers/ directory.
Each programmer, student, researcher can write its own walker: a walker
for analyze declarations,
a walker for analyze statements, and so on ...
"The gcc team write a compiler for the freedom, and in this way the team
give other fredoom."
We can also modify the previous sequence of passes by introducing some
others walkers. For example:
1 - parsing
1.1 walk around AST
2 - tree optmization
2.1 walk around Opt AST
3 - RTL generation
3.1 walk around RTL
4 - Sibiling call optimization
5 - ................
6 - ................
What do you think about this ?
Gianluca Masone, ... maybe in the future i'll become a programmer !
Bye, bye.
______________________________________________________________________
Yahoo! Cellulari: loghi, suonerie, picture message per il tuo telefonino
http://it.yahoo.com/mail_it/foot/?http://it.mobile.yahoo.com/index2002.html