how are programming languages programmed?

111 views
0

I tried searching this on google but all answers are wayyy to complicated for me. Like literally how did they create Java for example? Thanks

In: 6

Assembly[Assembly Language](https://en.m.wikipedia.org/wiki/Assembly_language)?

Is that what you’re asking?

If you’re talking about compilers and such program that make programming languages usable.
Usually an older language.
For example Java’s first compilers were written in the programming language C.
C seem to be the one a lot of languages were written in, because it’s both very fast and very old.
Older languages such as C were written in Assembly Language.
Each assembly language only works on a certain kind of processor it runs on, and we’re running into the dark ages before they were pretty standardized. It’s just one step above the machine code that basically telling the processor what to do. And include some bear minimum stuff for a human to use it a lot and remain sane.

That step above machine code was made by programmers actually figuring out what exactly they wanted the processor to do in machine code, in order to make the first assemblers (thing that makes assembly code into machine code).

Anything lower and you’re talking with the chip guys connecting wires.

A computer can understand one thing – machine language. Machine language is a set of simple commands written using 0s and 1s, commands such as “add two values”, “read a value from memory”, “jump to another place in the code”, and so on. The code inside an executable file is usually written in this language.

A programming language is written in a way that is easier for humans to read and to program in. However, the computer can’t understand it “natively”. In order for the computer to run the program, you need to translate it to machine code. This is done using a “compiler”, which is a program written specifically to translate code from one language to machine code.

So in order to create a new language, you essentially need to create two things:

1. A language specification – a set of rules which dictate how the language works, how the code is structured, what kind of keywords and symbols are used, etc.

2. A compiler – the program that uses the aforementioned rules to translate the high level code into machine code.

Java (and some other languages) is a bit more complicated. The Java compiler doesn’t translate code directly into machine code. Instead, the code is translated into some kind of intermediate code. In order to run this code, you need another program called the Java Runtime of Java Virtual Machine that will run the code for you. That’s why you need to install Java on your computer in order to run Java programs, and you can’t run them directly.

To keep it ELI5: there’s a “super” programming language that all CPUs are made to understand called the instruction set. On top of that is Assembly, which is a bit more readable but still hard to comprehend and especially maintain when programs grow larger and more complex. Then on top of that is the programming language of your choice.

As for how that programming language gets “translated” to Assembly, it kinda depends on how the programming language is designed. A programming language like Java runs in a Java Virtual Machine or JVM (although I’m sure someone has made a native compiler somehow) whereas something like C gets compiled directly into Assembly.

What a programming language is at it’s heart, is something that takes a particular format of text document, and does what it says. The two main methods of this are interpretation (where a programm called an interpreter goes and reads what the txt says word by word) and compilation (where a compiler first transformed the txt document into a lot of smaller simpler instructions that’s easier for it to understand).
Either way, the compiler or interpreter is just an ordinary program. You can write them in any language you like.
Going from the very start though was very hard.before compilers you had assemblers. This also takes text as an input, but the format was pretty close to the base level instructions, all the assembler had to do was replace a memonic with the “number” of that instruction.