Related articles |
---|
PCC, TCC - new front end prenom_nomus@yahoo.com (Marco) (2009-05-22) |
Re: PCC, TCC - new front end rpw3@rpw3.org (2009-05-24) |
Companion language was PCC, TCC - new front end prenom_nomus@yahoo.com (Marco) (2009-05-25) |
Re: PCC, TCC - new front end herron.philip@googlemail.com (Philip Herron) (2009-06-03) |
From: | rpw3@rpw3.org (Rob Warnock) |
Newsgroups: | comp.compilers |
Date: | Sun, 24 May 2009 21:50:03 -0500 |
Organization: | Rob Warnock, Consulting Systems Architect |
References: | 09-05-106 |
Keywords: | tools |
Posted-Date: | 25 May 2009 05:05:06 EDT |
Originator: | rpw3@rpw3.org (Rob Warnock) |
Marco <prenom_nomus@yahoo.com> wrote:
+---------------
| I am looking to create what I would call a "companion language" to C.
| It would basically compile to .o files that would be linked with other
| standard C generated .o to create the executable. It would of course
| use the standard C library when needed.
|
| I have no desire or time to learn a complicated compiler such as gcc.
....
| Would generating C code be a better approach? Is there a fairly simple
| example project out there to start with? My concern is that this may limit
| what the "companion language" can be (besides the obvious linkage aspects).
|
| Ultimately I would like it to target 32 bit ARM, x86 and PowerPC
| embedded targets so cross-compiling is a must.
+---------------
If you can tolerate Scheme as your "companion language", you might find
the following paper of interest:
http://lambda-the-ultimate.org/node/1752
An Incremental Approach to Compiler Construction
Abdulaziz Ghuloum (Indiana University)
...
This paper from the [ICFP'06] Scheme workshop presents an extended
tutorial showing how to implement a compiler from Scheme to x86
assembly language. The compiler is written in Scheme...
An important aspect of the presentation of the material is that
the compiler is built incrementally, and the product of each step
is a working compiler for a growing subset of the language.
...
Full paper (from the ICFP 2006 Scheme workshop):
http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
An Incremental Approach to Compiler Construction
Abdulaziz Ghuloum
...
We assume that the reader is familiar with the basic computer
architecture: its components and execution model. Detailed
knowledge of the Intel-x86 architecture is not required.
...
Additionally, the compiler we develop is small enough to be easily
portable to other architectures, and the majority of the compiler
passes are platform independent.
...
So that should handle your cross-compiling to embedded targets requirement.
-Rob
p.s. If you'd prefer to target C instead of assembler, you might prefer
this paper:
http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/minutes-en.html
The 90 Minute Scheme to C compiler (with video)
Marc Feeley
Montreal Scheme/Lisp User Group, 20/10/2004 Meeting
Marc showed us how to write a simple Scheme to C compiler, in Scheme.
In only 90 minutes! And although not supporting the whole Scheme
standard, the compiler supports fully optimized proper tail calls,
continuations, and (of course) full closures. The compiler is
implemented using two important compilation techniques for functional
languages: closure conversion and CPS-conversion.
[Contains links to slides in PDF, compiler source code,
and AVI video of presentation.]
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
Return to the
comp.compilers page.
Search the
comp.compilers archives again.