Re: Need: ANSI C to p-code compiler

derek@knosof.co.uk (Derek M Jones)
31 Oct 2000 14:34:11 -0500

          From comp.compilers

Related articles
Need: ANSI C to p-code compiler vchand@cs.man.ac.uk (Vijay Chand) (2000-10-26)
Re: Need: ANSI C to p-code compiler derek@knosof.co.uk (2000-10-31)
Need: ANSI C to p-code compiler dk%farm.cs.kiev.ua@ussr.eu.net (1992-11-04)
| List of all articles for this month |
From: derek@knosof.co.uk (Derek M Jones)
Newsgroups: comp.compilers
Date: 31 Oct 2000 14:34:11 -0500
Organization: Knowledge Software
References: 00-10-206
Keywords: C, question
Posted-Date: 31 Oct 2000 14:34:11 EST

Vijay,


>Are there any free ANSI C compiler implementation (source) which
>generates some explicit intermediate code for simple stack machine?
>(or can be easily tailored to do that).


I don't know of any free ones. Ours costs real money.


>No code generation besides that is required, nor _any_ optimizations
>(besides may be simple constant pasting in expression trees).


We originally did no optimizations. But then silly things like
adding zero to an address to get the addres sof the first member of a
struct started to look like cutting our nose off to spite our face.
So some 'obvious' optimizations were done.


Hmm, what is simple constant foloding? We don't do any except in
contexts required by the standard. It means that the semantics are
guaranteed to be identical to the same values occurring in operands
that are objects.


>the compiler is about to be used for embedding into applications
>(maybe java or something else. So size is much more important than
>speed).


The compiler source is 49k lines. lcc is about the same size (but excludes
a preprocessor).


Targeting the JVM? Quiet hard to do since you need to rely on undefined
behaviour (accessing arrays with types different from when they were
allocated).


Post a followup to this message

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