From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26612 invoked by alias); 31 Dec 2002 16:22:51 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 26605 invoked from network); 31 Dec 2002 16:22:50 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 209.249.29.67 with SMTP; 31 Dec 2002 16:22:50 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18TR2j-00058o-00; Tue, 31 Dec 2002 12:23:09 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18TPA6-0007kq-00; Tue, 31 Dec 2002 11:22:38 -0500 Date: Tue, 31 Dec 2002 10:15:00 -0000 From: Daniel Jacobowitz To: James Buchanan Cc: gcc@gcc.gnu.org Subject: Re: New front end, help needed Message-ID: <20021231162238.GA29737@nevyn.them.org> Mail-Followup-To: James Buchanan , gcc@gcc.gnu.org References: <5.1.0.14.0.20030101031203.009f2a00@pop.iprimus.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.1.0.14.0.20030101031203.009f2a00@pop.iprimus.com.au> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-12/txt/msg01644.txt.bz2 On Wed, Jan 01, 2003 at 03:14:47AM +1100, James Buchanan wrote: > Hi everyone, > > I suppose the thing that stumps me is the trees. I have > looked in tree.def, tree.h, coretypes.h and many other places > without much success. Sometimes it appears to be a union > (coretypes.h - but just a nothing typedef saying tree is a > pointer to union treenode) but sometimes it appears to be a > struct. I can't see what it is supposed to be. If I could make > these trees for arithmetic expressions, assignment > statements, functions, and so on, then I could compile a > new language by writing a front end. But I don't even know > where to start. > Suppose I need a string, use an ARRAY_DECL (as in an array > of chars or unicode wchar's) or a POINTER_DECL? I suppose > I don't use POINTER_DECL, since there is no actual object, > only a placeholder address for something else, so I use an > ARRAY_DECL or something to internally represent var$ as > a C string. > > Where to from here? I need to grow strings automagically > within the compiler, and handle IF var$ = foo$ THEN... by > calling strcmp() or something like that, within the runtime > library. How do I implement these operators? How do I > get the assembler that is generated to hook into the > runtime code needed? > > Sorry for all this, but I am not sure who to ask or where > to look or anything like that. You should take a good look at "treelang", which is the sample frontend, and also a good look at the GCC Internals manual (gccint.info in gcc/doc/ in a built tree). -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer