Re: Writing a compiler

kamal <>
Wed, 29 Oct 2008 22:56:57 -0700 (PDT)

          From comp.compilers

Related articles
[3 earlier articles]
Re: Writing a compiler (2008-10-23)
Re: Writing a compiler (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2008-10-23)
Re: Writing a compiler (Manuel Collado) (2008-10-24)
Re: Writing a compiler (Nick) (2008-10-26)
Re: Writing a compiler (RR) (2008-10-26)
Re: Writing a compiler (andresj) (2008-10-29)
Re: Writing a compiler (kamal) (2008-10-29)
Re: Writing a compiler (Tony) (2008-10-31)
Re: Writing a compiler (Louis Krupp) (2008-11-01)
Re: Writing a compiler (Marco van de Voort) (2008-11-02)
Re: Writing a compiler (Chris Dollin) (2008-11-03)
Re: Writing a compiler (Louis Krupp) (2008-11-03)
Re: Writing a compiler (Alex Colvin) (2008-11-03)
[5 later articles]
| List of all articles for this month |

From: kamal <>
Newsgroups: comp.compilers
Date: Wed, 29 Oct 2008 22:56:57 -0700 (PDT)
Organization: Compilers Central
References: 08-10-037
Keywords: practice
Posted-Date: 31 Oct 2008 10:16:13 EDT

On Oct 21, 4:20 am, andresj <> wrote:
> Hello, I am designing a programming language that will run natively.
> That is to say, it will run like C, without a need of an interpreter

you must mean you want to write a bootstrap compiler for a particular
chip set.

> nor a standard library (well, there will be, but I want to be able to
> write an operating system, too.)

hmm. microsoft has something in the works called singularity (OS +
compiler + loader all combined into one).

> The language parsing (converting a=b into <assignment><variable
> name="a"/><variable name="b"/></assignment>---which is not necessarily
> correct, anyways) I will skip for now; I will write directly in XML
> and use a XML parser to get a tree of my program.
> * I need help in finding an appropiate way of structuring my XML. Any
> ideas/links?
> The next part is where I need more help in: how to convert this tree
> into assembly language.

There are some intermediate formats out in the public domain. So, you
need to write the front-end to generate 3-address code which is
compliant with what the IM accepts.

> * Is there any documentation on this part of writing a compiler?

you just need to bridge/handshake the front-end with the IM

> This compiler will not need to be fast (might be written in Python or
> Ruby or Java---although I don't like Java that much---, instead of C
> or C++, which is counterintuitive for me); I will write a new compiler

That is just your constraint/preference. From the compiler writers
standpoint, you need a method to get tokens for terminals, and a
parser generator that generates a parser to do SDT (syntax directed
translation). I am not aware of whether there are parser generators to
generate python code (but there are for java).

> in the language I am creating (kind of what was done for C.)
> Thanks for your help. :)
> * Any other articles/ideas on writing compilers or designing
> programming languages are welcome. :-)

the design of a programming language depends on what it is going to be
used for. So, you need to look at who the end user is, what the
purpose of using that language is etc.. and then provide a grammar
that makes their job easier.


Post a followup to this message

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