gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Re: GNU Modula-2 progress


From: Gaius Mulley
Subject: [Gm2] Re: GNU Modula-2 progress
Date: Thu, 23 Nov 2000 16:04:39 +0000

Hello Toni,

address@hidden writes:
> I thought you could give me some hint about where to look (documentation
> or source files inside gm2) to learn how to build the GBE internal
> representation (parse tree?).

I hope it is alright to CC my reply to the gm2 mailing list as I can
imagine this question coming up in the future.

I found several sources of information useful:

the front end documentation translated by Tim Josling.  Tim is working
on GNU Cobol. He emailed me his documentation diffs which I can email
you if you wish. However the ones I have were from Jan 03 2000.  Which
in gcc terms is a long while ago :-) and many internals have now
changed.

The toy language as mentioned in the comp.compilers faq was also
useful - basically it gives an example of a small language which
creates simple functions and calls simple functions. I don't know
whether this is up to date regarding current the gcc strategy however.

Examining the C front end source code and Pascal front end helped a lot.

Gcc has changed quite a lot since last year, in particular obstacks are
being removed and in place is garbage collection.

Regarding GM2 I followed the advice in the front end documentation of
employing double book keeping - which works pretty well imho. Ie keep
the front end symbol table and translate each m2 symbol into a gcc
symbol. This way there was a clear separation between front/back end
and when the conversion occurs you know the complete data type,
declaration etc. In GM2 it also means that when conversion of
intermediate code and symbol table occurs we know everything should be
legal, in theory we have to worry about the error_node less than say
the C front end, otoh the C front end is faster.

Concerning FE and BE integration and GM2.
Inside the gm2 directory structure a synopsis of the important files are:

gm2/gccgm2.c   (the C code which interfaces with the BE, this needs to be
               cleaned up, currently underway, much code lifted from the C
               front end).

gm2/m2/comp/gm2s/gcc
               SymbolConversion.mod   - performs the double book keeping
               M2GCCDeclare.mod       - translates M2 symbols into GCC 
equivalent
               M2GenGCC.mod           - translates the quadruples into GCC trees
                                        and then it calls upon the BE to 
translate
                                        trees into code.

hope this helps?

Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]