This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New front end, help needed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]