What does the code that makes up programming languages look like?

1.12K views

Take a language like Java. How was it originally created? I can’t wrap my head around how someone invented a computer language to run without having some “prior” language that it allows the first lines to function. Is it just Java all the way down, like someone wrote a single line of Java and then every other line was built on that?

What about the first computer language? What was the basis that that functioned on?

Thanks for any help, I hope that was phrased in a mildly intelligible way.

Edit; I’m trying to think of it like human language: at some point there was a first “word” spoken by someone and understood by another and from there the structure started to be born. What were the first “words” on a computer that led to where we are now?

In: Technology

36 Answers

Anonymous 0 Comments

This is a pretty good video explaining how machine code works:

I’ll try to ELI5:

When you build a computer chip it can perform some very elementary set of tasks. In order to make that chip useful, it is programmed with “microcode”. That microscope exposes to the user a VERY simple set of machine instructions. We call this “machine language” This machine language is extremely abstract with everything being represented by numeric codes. For example a 2 byte sequence AB 04 might mean “load the number 4 into the X register of the CPU”. CD 06 might mean add 6 to the value in the X register and store the result in the X register. 4C 5A 44 might mean store the value in the X register in memory location 5A44, etc. Machine code is EXTREMELY tedious to use, as you might imagine.

So, what kinds of programs might one write in machine code? Well, technically anything. If you’re a masochists. But among the first machine programs written was probably an Assembly Language compiler. What does a compiler do? It reads in some data and outputs computer code. To write a compiler you might define an “Assembly language” that allows users to write code that looks like this and store it in a text file.

LDX 4
ADX 6
STX 5A44

An assembly compiler could then read that file and create machine code from it, converting our text file into code the computer can actually run:

AB 04 CD 06 4C 5A 44

What kinds of programs can you write in Assembly? Well, technically anything but among the early assembly language programs written was a compiler for an even higher level language, like “c”. This compiler might let me write a program that looks like this:

counter := 4;
counter := counter + 6;
store_mem(5A44, counter);

We call these 3rd generation languages. But what if you want to write a coding game for kids where they write programs just by dragging icons around? What do you think that coding game does? It turns those squares and arrows in the kids programming game into C or assembler or some other language which in turn gets compiled into machine code. We call this type of code “4GL” or 4th generation language.

In short, we use super low level languages to write compilers or interpreters which allow us to write more human readable code, but that code just ends up getting “translated” back into a lower level language. At the end of they day, the only code your computer actually runs is machine code, everything else is just a layer of abstraction built on top of machine language.

You are viewing 1 out of 36 answers, click here to view all answers.