Re: What makes a compiler, was Is Assembler

Walter Banks <walter@bytecraft.com>
Thu, 19 Feb 2009 10:26:52 -0500

          From comp.compilers

Related articles
[3 earlier articles]
Re: What makes a compiler, was Is Assembler lkrupp@pssw.com (Louis Krupp) (2009-02-14)
Re: What makes a compiler, was Is Assembler haberg_20080406@math.su.se (Hans Aberg) (2009-02-15)
Re: What makes a compiler, was Is Assembler cr88192@hotmail.com (cr88192) (2009-02-16)
Re: What makes a compiler, was Is Assembler tony@my.net (Tony) (2009-02-15)
Re: What makes a compiler, was Is Assembler tony@my.net (Tony) (2009-02-15)
Re: What makes a compiler, was Is Assembler cr88192@hotmail.com (cr88192) (2009-02-19)
Re: What makes a compiler, was Is Assembler walter@bytecraft.com (Walter Banks) (2009-02-19)
Re: What makes a compiler, was Is Assembler cr88192@hotmail.com (cr88192) (2009-02-21)
| List of all articles for this month |

From: Walter Banks <walter@bytecraft.com>
Newsgroups: comp.compilers
Date: Thu, 19 Feb 2009 10:26:52 -0500
Organization: Compilers Central
References: 09-02-021 09-02-035 09-02-054 09-02-069 09-02-080 09-02-093
Keywords: design, practice
Posted-Date: 19 Feb 2009 11:24:34 EST

cr88192 wrote:


> > Tony
> > [The Burroughs compilers are real Algol compilers. If you're not worried
> > about optimization, it's quite possible to generate adquate code on the
> > fly from each grammar rule. See Irons classic 1961 paper on Syntax
> > Directed Translation. -John]
>
> I had once thought of this and considered it might even be possible to
> compile a C-subset this way. it had seemed like a way to make a very
> fast and lightweight compiler, as it could avoid much of the overhead
> of managing internal structures and going through some number of
> stages.
>
> however, I don't think full C could be compiled this way (or, at least
> not C99), and I am not even sure some things could be compiled propery
> (for example: the source has function arguments in left-to-right
> order, but many calling conventions require right-to-left ordering,
> ...).


20 plus years ago we implemented a single pass compiler that was
implemented as parser that front ended on the back end of a macro
assembler. All the symbol table management was done in a single symbol
table. Code was translated directly into machine code with no
intermediate form (including no asm) It was surprisingly efficient and
very quick.


For full C this approach would likely be very difficult. The problem
as I see it would be to change C back into the macro form that K&R
were using. This would involve a lot of context sensitive grammar and
code sequences.


The modern alternative might be to use heuristic code generation to
replace the multiple optimization layers. Cherry pick the easy stuff
and maybe generate machine code directly. This would probably produce
reasonable code and has to potential to be quick.


Regards,


--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.