how are programming languages programmed?

663 views

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

9 Answers

Anonymous 0 Comments

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

Is that what you’re asking?

Anonymous 0 Comments

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.

Anonymous 0 Comments

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.

Anonymous 0 Comments

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.

Anonymous 0 Comments

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.

Anonymous 0 Comments

All programming languages (when it comes down to it) either are compiled – translated directly to something the computer can understand down at the metal – or interpreted – read by a different program that tells the computer what to do as it’s reading.

So, if you want to make a new programming language all you have to do is use any of the numerous already existing programming languages to write a program that does one of the two things: Either turns files written in your new language in to something the computer understands without help, or reads the file and executes the code as it goes.

There are some nuances and “in-betweens”, but that’s more or less how it goes.

In the long ago before human-readable programming languages existed you’d type in your program directly in to memory, either via physical switches, a series of punch-cards, or other similar systems.

Anonymous 0 Comments

Programming languages are in a sense just *ideas*. You can *invent* a programming language, just by making a list of words and syntax rules and defining exactly how you want them to be interpreted. (The difference between a programming language and a human language is that exactness; everything has to be *perfectly* well-defined.)

The computer itself only speaks a language called “binary machine code”, consisting of a list of 1s and 0s that you can think of as physically flipping switches inside the machine. (If you look at pictures of early computers like [ENIAC](https://en.wikipedia.org/wiki/ENIAC#/media/File:Two_women_operating_ENIAC_(full_resolution).jpg), you can see that they actually had banks of physical switches for the programmers to flip, rather than being controlled digitally.) If you write a program in a programming language rather than in machine code, it has to be translated into machine code before the computer can run it.

Translating your program into machine code is a task that can be done by hand by a human being, but it tends to be long and tedious. So we typically automate it by using a type of computer program called a “compiler” to do the translation for us.

Compilers are just programs like any other, and can be programmed in any language you want. There’s nothing stopping you from using a programming language to write a compiler for that same programming language. (In fact, there are reasons why you might want to do so, if you think you can create a compiler that runs faster, outputs more compact binary code, and/or has better debugging tools than existing compilers do.) The first compiler would have been translated into machine code by hand; later compilers were translated using earlier compilers.

Anonymous 0 Comments

Nerds come together and ritually summon new languages by sacrifing different globally renowned scientists like Stephen Hawking

Anonymous 0 Comments

The other messages sum it up pretty good 🙂

If you’re interested to learn more look at this book:

https://craftinginterpreters.com

(The online version ist available for free)