Re: Writing a C compiler in Java/Jython

"walter" <walter@nospamm-digitalmars.com>
10 Jun 2001 22:48:53 -0400

          From comp.compilers

Related articles
Writing a C compiler in Java/Jython adsharma@sharmas.dhs.org (2001-06-07)
Re: Writing a C compiler in Java/Jython torbenm@diku.dk (2001-06-08)
Re: Writing a C compiler in Java/Jython korek@icm.edu.pl (2001-06-10)
Re: Writing a C compiler in Java/Jython walter@nospamm-digitalmars.com (walter) (2001-06-10)
Re: Writing a C compiler in Java/Jython mcc@watson.ibm.com (2001-06-14)
| List of all articles for this month |
From: "walter" <walter@nospamm-digitalmars.com>
Newsgroups: comp.compilers
Date: 10 Jun 2001 22:48:53 -0400
Organization: Excite@Home - The Leader in Broadband http://home.com/faster
References: 01-06-019
Keywords: Java, practice
Posted-Date: 10 Jun 2001 22:48:53 EDT

In order to successfully compile C, the reality is that by the time
you add up all the lines of code in the headers, etc., you can wind up
with a million lines of code to compile. To do this in a reasonable
time frame means that the implementation language you choose needs to
have a well implemented, highly optimizing compiler.


Frankly, C and C++ will likely be your best choice, as the most
attention has been made by compiler vendors to generate quality code.


Python is fine for writing short programs, but for writing large
programs you need to have it compiled and you need it to be typesafe,
otherwise you spend too much time chasing typo bugs.


The implementation language doesn't need to be garbage collected. You
can just use a mark/release storage allocator, which is extremely fast
and works well compiling C.


For intermediate code that's suitable for optimization, using triples
or quads works well. They also work well for register allocation,
graph analysis, code motion, etc. Using binary trees can be clunky
because it's hard to do code motion with them. Generating stack
machine intermediate code makes optimization *really* hard <g>.


-Walter
www.digitalmars.com Free C/C++ compilers


Arun Sharma wrote
>I wanted some opinions from people who might have attempted this in
>the past: Writing a C compiler in Java. Also, would using a scripting
>language like python (specifically the jython implementation of the
>language) have any advantages in writing optimization algorithms ?


Post a followup to this message

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