World's most popular travel blog for travel bloggers.

Compile a programming language with itself

, , No Comments
Problem Detail: 

I'm a computer science student. I want to create my own programming language (A basic language with few instructions).

I know how to do a syntactic analyser, I already did it in Perl. In an article, I read something about the compiler, a compiler is done in itself.

For example the C compiler is written in C. How it's possible? I can make my own language but I don't know how I could execute it? Any idea?

It's really a good question and I can write a blog the project.

Asked By : Neobrain

Answered By : Gerry Rzeppa

Some years ago my son and I wrote a stand-alone compiler and development environment for Windows that compiles English-like code into Intel machine language. We still use it today. It includes a simplified desktop (that looks exactly the same on all versions of Windows), an efficient file manager, an elegant text editor, a hexadecimal dumper, a native-code-generating compiler/linker, and a wysiwyg page editor (that we used to write the documentation). The whole thing is less than a megabyte in size and can recompile itself in three seconds on a bottom-of-the-line computer from Walmart. So if you'd like to see how a compiler can compile itself, take a look:

www.osmosian.com/cal-3040.zip

Just download and unzip it; no install is necessary. Start with the "instructions" PDF in the "documentation" directory, and before you go ten pages you'll be reading the documentation in the built-in page editor and recompiling the thing in itself.

Feel free to write me directly (gerry.rzeppa@pobox.com) if you have any questions. Or if you'd like to try your hand at rewriting the thing from scratch (which is a great way to get an in-depth computer science education real fast and real cheap).

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/16248

0 comments:

Post a Comment

Let us know your responses and feedback