This is the mail archive of the gcc-patches@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]

treelang patch


At last, here is the final patch for the sample language 'treelang'.
This is a sample language useful (hopefully) to help people see how to
write a new language front end to gcc. It has the following features

- Complete - actually builds the language and runs a test suite of one
tests. Note - it does not build by default - you have to ask for it in
your configure/make if you want it built.
- Incorporates a lexer and parser
- Uses many but not all gcc features. Main gaps are unions and structs
- As simple as possible but not simpler
- The language is similar to C but without syntactic sugar that C has
but which is not really supported in gcc.
- Follows all the rules written and unwritten as far as I can tell.
- Builds with the latest weekly snapshot (gcc_latest_snapshot).

The patch is here:

http://www.geocities.com/timjosling/treelang_diff.txt

This new language has been approved by the gcc steering committee and
they have given me update access to the source tree to facilitate this.
This all occurred some months ago.

I have been delayed in submitting the final patch due to the switchover
to gcc3.1 in the source tree which required quite a few changes and
various other things not relevant here.

I acknowledge the following limitations of treelang

- The doco exists but is not integrated into the gcc book (yet). One
thing at a time. I hope to write a guide to buliding a new front end and
at that point incorporate it into the gcc book
- Structs and unions are not supported as mentioned previously
- Exceptions/try/catch are not supported.
- Some people do not like the way I define the interface between the
parser and the language interface routine (treetree.c), specifically,
the fact I do not use a mega-union of all parse entity types. If someone
wants to change that, send me a tested patch: I have seen the error of
my ways but I don't have time to fix it.
- The indenting and commenting is mostly compliant with the requirements
but there are occasional lapses.

Any feedback and/or patches would be welcome. If nothing drastic comes
to light I will apply the patch on 28 April 2002.

Tim Josling




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