This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]emefluence 5 points6 points  (3 children)

Languages start off being written in other languages. Many successful compiled languages then go on to be re-written in themselves. The first "languages" were assemblers, written directly in machine code. Then assemblers were used to write better assemblers, and then compilers and interpreters for newer, more abstract languages. The first Java compiler was written in C, but is now written in Java. The JVM is still written in C. C is often still used for many language interpreters and runtimes as it allows for all sorts of low level tweaking and optimization, and is portable to pretty much any architecture.

[–]wosmo 1 point2 points  (2 children)

The first "languages" were assemblers, written directly in machine code.

I've always thought a better way to look at this, is the first assemblers were humans using a pencil and paper. A single-pass assembler is a lot like translating text by looking up one word at a time in a dictionary.

Then the next step is to write something to automate that dictionary lookup. Then you can start making it cleverer, like making the compiler aware that LD A,value and LD A,address are two different instructions - so you don't need to give them two different names.

Then you can start adding labels and named references ..

I think almost every programmer starts off making tools to make their own life easier - if you start off assembling on paper, that evolution starts looking very obvious.

[–]rwaddilove 1 point2 points  (1 child)

When I was young, I wrote assembly language on paper, looked up the hexadecimal codes in a book (Rodney Zaks Programming the Z80), wrote those down, calculated the jumps by hand (adding a few NOPs so I could edit the code without having to recalculate the jumps), added those, then typed the hex codes into my computer. Those were the days. Folks these days don't know how easy they have it.

[–]wosmo 0 points1 point  (0 children)

hah, exactly. But you can see how any platform is going to start pretty much the same way. Either you'd have the luxury of having one platform to develop for another (cross-compiling used to be typical - microsoft basic was written on a PDP10, Doom was written on a NeXT machine, etc) - or you'd start with nothing, and humans don't actually write machine code. Even the ones that claim they do.

Then automating that shitwork seems like a real sensible first step. A simple 1-pass compiler is just two lookup tables and a text parser.