This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Newbie to creating front ends to gcc
- To: gcc at gcc dot gnu dot org
- Subject: Newbie to creating front ends to gcc
- From: David Henningsson <a at davidh dot df dot lth dot se>
- Date: Sun, 15 Jul 2001 23:22:14 +0200
Right now I'm trying to understand that tree code.
I think I need a simple example of how to create a tree. How would I eg
create tree for this function?
int foofunc(int x)
{
return 7+x-atoi("54");
}
something like:
int
yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
tree Tfuncname = get_identifier('foofunc'); /* Is this symbol exported
now? */
tree Tconstant7 = build_int_2(7,0);
tree Tfuncres = makenode(INTEGER_TYPE);
tree Tassign build1(MODIFY_EXPR, TFuncres, Tconstant7);
tree Tfunction = build(FUNCTION_DECL);
/* etc */
}
..well, that was as far as I came. And that is probably wrong. Could
someone please point me in the right direction?
(The final version of my program will of course parse a file...but I'm
not that far yet.)
I'm running GCC 2.95.3 at the moment as that is what goes with DJGPP.
Thanks in advance for your help!
// David