public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Newbie to creating front ends to gcc
@ 2001-07-17 12:51 Tim Josling
  2001-07-17 14:08 ` Neil Booth
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Josling @ 2001-07-17 12:51 UTC (permalink / raw)
  To: gcc

Also you can download this, which is a toy language as simplified
as possible that tries to demonstrate in as uncluttered a manner
as possible how to interface into the tree stuff. I will be
submitting it as a formal patch to gcc soon.

It does not exercise all of the tree interfaces (notably structs
and unions are missing), but it shoudl get you started. And it is
complete - ready to load into the gcc and go, with all the
makefile fragments, spec files etc.

http://cobolforgcc.sourceforge.net/butree.tgz

Tim Josling

> 
> On 15-Jul-2001, David Henningsson <a@davidh.df.lth.se> wrote:
> > Right now I'm trying to understand that tree code.
> > 
> > I think I need a simple example of how to create a tree.
> 
> See < http://gcc.gnu.org/readings.html >,
> in particular "Example and Toy compilers for current snapshot".
> 
> See also the "Writing a Compiler Front End" chapter of
> "Using, Maintaining and Enhancing COBOL for the GNU Compiler
> Collection (GCC)".
> 
> > I'm running GCC 2.95.3 at the moment as that is what goes with DJGPP.
> 
> That is quite out-of-date with respect to current sources, unfortunately.
> To save yourself effort, I'd strongly recommend using GCC 3.0 or a recent
> development snapshot.
> 
> If you're stuck with using Windows, that may make things a little more
> difficult.  I don't know whether 3.0 or recent development snapshots
> work with DJGPP, but I think they probably do work with Cygwin.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Newbie to creating front ends to gcc
  2001-07-17 12:51 Newbie to creating front ends to gcc Tim Josling
@ 2001-07-17 14:08 ` Neil Booth
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Booth @ 2001-07-17 14:08 UTC (permalink / raw)
  To: Tim Josling; +Cc: gcc

Tim Josling wrote:-

> http://cobolforgcc.sourceforge.net/butree.tgz

Are you going to submit a patch to put this in the tree?

Neil.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Newbie to creating front ends to gcc
  2001-07-15 14:23 David Henningsson
@ 2001-07-16  3:40 ` Fergus Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Fergus Henderson @ 2001-07-16  3:40 UTC (permalink / raw)
  To: David Henningsson; +Cc: gcc

On 15-Jul-2001, David Henningsson <a@davidh.df.lth.se> wrote:
> Right now I'm trying to understand that tree code.
> 
> I think I need a simple example of how to create a tree.

See < http://gcc.gnu.org/readings.html >,
in particular "Example and Toy compilers for current snapshot".

See also the "Writing a Compiler Front End" chapter of
"Using, Maintaining and Enhancing COBOL for the GNU Compiler
Collection (GCC)".

> I'm running GCC 2.95.3 at the moment as that is what goes with DJGPP.

That is quite out-of-date with respect to current sources, unfortunately.
To save yourself effort, I'd strongly recommend using GCC 3.0 or a recent
development snapshot.

If you're stuck with using Windows, that may make things a little more
difficult.  I don't know whether 3.0 or recent development snapshots
work with DJGPP, but I think they probably do work with Cygwin.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Newbie to creating front ends to gcc
@ 2001-07-15 14:23 David Henningsson
  2001-07-16  3:40 ` Fergus Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: David Henningsson @ 2001-07-15 14:23 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-07-17 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-17 12:51 Newbie to creating front ends to gcc Tim Josling
2001-07-17 14:08 ` Neil Booth
  -- strict thread matches above, loose matches on Subject: below --
2001-07-15 14:23 David Henningsson
2001-07-16  3:40 ` Fergus Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).