Re: Original/Base Programming Language?

Posted 19 April 2010 - 03:52 PM

Talking about languages that would be assembly language, which is translated into opcode which are in binary code which are then stored in a hex file like this for example: (intel hex, examplecode from wikipedia)

A processor work like this, it has a number of different things it can do, different instructions. For example a simple processor might have these instructions, "IN" "OUT" "ADD" among others. These are represented in the memory as opcodes (and the processor read one opcode at the time), the idea is simple and is based on that some bits are to identify what instruction it is and some bits to store data.

Okey, so a simple assembler program could be like this: (This is AVR assembler, an RISC microcontroller but the concept is the same for all cpu's)

IN temp1,pina ; This opcode would store specific code for "IN" instruction, a place to put it, and a place to read from
ADD temp1,temp2 ; This opcode would store specific code for "ADD" instruction, and an address to the two registers temp1 and temp2
OUT portb,temp1 ; This opcode would store specific code for "OUT" instruction, a place to put it, and a place to read from

This is a quite simple addition and it uses binary numbers to do so, but of course that is only a way of representing a number so in a higher level language you don't see that but the computer always use binary numbers. To get loops and if statements for example you can use instructions to compare two numbers and then brash/jump if they are equal etc. With the assembly language of a processor (different for different CPUs, x86 for example an instruction set so all x86 have the same opcodes) you can then write a compiler.

So to sum up, the "base language" is opcode, that is each instruction record that the processor reads from memory. To program this in a simpler way you have assembly language where each opcode has a instruction like "ADD", that makes it easier to write software. Next step is to write a C compiler for example, it would from the beginning be written in assembler, then once you have an compiler you can rewrite the compiler in C and compile it again with your first compiler... And then you have a compiler in C!

Hope this was helpful! You can ask more if you want to or search some of the words above on google/wikipedia for more info..

EDIT: For high level languages people don't want to reinvent the wheel all the time so those compilers or interpreters of are often written in C for example.