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

1.11K 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

You can think of it as layers of an onion. The lowest layer is machine code – functions of the 0’s and 1’s that computer data is stored as.

The next layer is Assembly language, which is just easier to read machine language – the simple functions of 0’s and 1’s are given a name, and grouped. It, like the machine language are specific to the computer chip that will run the program.

The next layer toward JAVA is C++, (which derived from the C programming language), and now it is no longer computer chip specific, it is a general language used to write code for any computer. You run this code through a “compiler”, that converts the C++ into the machine specific assembly language.

The outer layer is the JAVA, which is an easier to use language than the C++. Think of this like a paragraph of C++ does what you want, but you can just give that paragraph a JAVA name, like “A”. Instead of writing all that C++ to do the function you want, you just say in JAVA “do A”.

Anonymous 0 Comments

ELI5 answer:
It look very, very simple.
The code that makes up programming languages itself is very simple.

The language can then be quite complexe. Java is one of the worst example you could pick, because it is an interpreted language (this means than it relies on another programm, the interpreter, to run).

But the codes that build it is simple.

It starts with basic instructions:
I want to add data. Instruction: add
I want to store my result: store

You might want to creat type: a byte might be an integer, or a character.

Then, you need to repeat the same instructions in your language.
You start to put a label at the start of your instruction: label my_little_routine
Then you say that you want to go to your label again: goto my_little routine

Then you say that this set of instruction should be used everywhere, so you create a function. This is a mechanism where you store your current data somwhere, then go to your label, then extract your data back from storage once you finish.

You can use a compiler of compiler to create an advanced programming language out ofthese basic operations: [YACC](https://en.wikipedia.org/wiki/Yacc) is one of them

Modern languages implement natively many high level mechanism called design pattern, which is why you are confused: templates in C++, interfaces in java, iterators in python…
These design pattern are common solution to frequent problems.

So we grow programming language, from simple, obvious instruction, to a complexe toolbox.

[Bonus track](https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/generalprogramming/ie_prog_4lex_yacc.html)

Anonymous 0 Comments

Many prior languages existed and some were similar to Java or c++.

I am a retired mainframe assembly language developer, I did that in the 80-90s. Assembly was the first mainframe language, it’s a step above the machine code executed by the chip. Assembly language is what many mainframe languages compiler generates as it’s native to the chipset.

Assembly is crude and rude, you better know WTF you’re doing or bad things happen. Sometimes you can have to read and understand the machine code to debug your code. Principles of Operation is the reference manual for the language.

ETA: One of our programs for class was to be written in machine code to demonstrate our knowledge of the language.

Anonymous 0 Comments

The very first “words” on a computer were some poor, patient soul litterally plucking in every 1 and 0 by hand. They’d do this by baking it straight into the circuitry rather than programming it with a keyboard, because, well, how would a keyboard even work if programming doesn’t exist?

People still do this all the time, by the way. A common tool that lets you experiment rapidly is called a “breadboard”, which lets you plug and unplug wires and simple chips to create complex circuits.

After the first literal hard-coded computers were in place, they were extended to be more modular and accept arbitrary input from users via input peripherals, that could then be run as new code. Everything snowballed from there.

Anonymous 0 Comments

Java is actually run by a “virtual machine” entirely written in C++. So it’s a pretty bad example.

But C++ is being compiled by compilers entirely written in C++. How do you compile such compiler? Well, with an older C++ compiler!

But, but, what about the first compiler? It was written in assembly, a long time ago. Although people like to bootstrap C++ from time to time, aka. start from scratch with a smaller language, easier to compile. But that’s just for the kicks of it.

By the way, did you know we need a mill to make a mill?

Lots of stuff in the world is built on previously built stuff, it’s kind of a fun chicken and egg problem. Almost all of them, originally started from painstaking manual work.

Edit: It’s even more fun when you realize C++ compilers have bugs, yet produce newer C++ compilers with less (hopefully) bugs.

Anonymous 0 Comments

It’s easy to build up a small sand castle with just a single small bucket, and this is like binary. If you want to build something amazing, though, you’ll need to have more tools to make the job doable. You can technically use binary to create whatever you like, although it is much easier to program simple programs which encompass basic tasks like adding or subtracting. Then, using this new program as a ‘frame’ for a new program, you can layer on complexity (or remove complexity, depends how you look at it) for accomplishing more complex tasks. This is the difference between coding “bare metal” and using a high-level language like Java.

There was a first word, but instead of thinking of it as a baby learning English, think of it as how humanity learned to communicate – we’re talking ancient runic text instead of “mom” or “dad”. Compared to programming, English itself is like a high-level language.