matthew at linuxfromscratch.org
Thu Jul 8 12:12:10 PDT 2004
On 08 Jul 2004 16:25:39 +0200
d95-bli at nada.kth.se (Björn Lindberg) wrote:
> Matthew Burgess <matthew at linuxfromscratch.org> writes:
> > On Wed, 7 Jul 2004 10:36:14 -0700 (PDT)
> > tino rozzo <teak at linux.net> wrote:
> > >
> > >
> > > I am interested in compilers that would allow me to:
> > >
> > > 1. Create my own Linux DOS
> > Your own Linux DOS? Uhm, they're two very different Operating
> > systems. I presume by DOS you mean a shell - i.e. something that
> > provides a command-line? Or maybe you want to create your own DOS
> > emulator (i.e. something that will allow you to run DOS programs
> > under Linux).
> > > 2. Create a programming language of my own design.
> > Wow - that's *very* ambitious.
> > > Is that possible? where would I get that stuff?
> > Well, anything's possible, but I've no idea where you'd start. If
> > my assumption about 1) is correct, then your best bet is probably to
> > study the source code of some existing open-source shells (bash,
> > ash, ksh, zsh, etc.). For 2) You'll definitely need some textbooks
> > on language design, compiler design/writing and an in depth
> > knowledge of assembly language, which is, at the end of the day,
> > what you're programming language compiler will have to produce as an
> > end result.
> Not necessarily. It could produce byte-codes for a virtual machine, eg
> the Java VM, or source code for another language, like C or Common
> Lisp. Not to mention that if he is content with an interpreter for his
> language, he doesn't need to write a compiler at all. I agree that it
> is quite an ambitious project in either case though.
All of your points are valid of course. I had actually thought of
mentioning byte-code, etc. but for the sake of brevity & clarity
omitted them. Just as a further point, the first C++ compilers
(e.g. Cfront) actually did exactly what you described above, i.e.
converted C++ code into C.
If I understand correctly, GCC takes the approach of converting all of
its supported languages (I believe) to an intermediate language (RTL)
which is then converted to assembly (or byte-code for Java I would have
thought). This may actually be the easiest (still not by any means
easy though!) way forward - just write a front-end (or is it a
middle-end?) to convert your new language into RTL and let GCC do the
More information about the lfs-chat