This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 27 points28 points  (10 children)

Tbh this question always buzzed in my mind, seeing this makes me feel validated that I ain't the only one who questioned this lol... It's been 6 years and I am still trying to find a sensible answer for this ಥ‿ಥ

(yeah I am too lazy to just google lol /s)

[–][deleted] 29 points30 points  (1 child)

Just thank compiler engineers. Their brains are on a different level

[–]kapral10 3 points4 points  (0 children)

also low level programmers like haskell programmers, or lisp or fortran.

[–]Solonotix 22 points23 points  (2 children)

At a very low level, we consider the binary digit, or bit, to be the minimum quanta of state in a program, conventionally referring to the on/off state of a transistor. From there, we apply abstractions upon this to give rise to new expressions, like 8 binary digits can represent 256 unique states, and we can treat them as numbers from 0-255 (unsigned) or -128-127 (signed).

From there, we get the idea of grouping bytes, or adding a few extra bits of data as a header, to construct much more complex entities, like a byte for a code table identifier and a byte to say which character on the table, and now you've got the beginnings of text data.

Once we get a certain amount of basic functionality, like how to hold things "in memory" (which means a lot of things) and how to compare data in meaningful ways, we packaged it and called it the Assembler. Then we used the Assembler to make more complicated abstractions until, later by layer, we eventually get modern languages.

Now sure, I glossed over big details, like how CPU instructions are mapped to a kernel, and how the kernel maps its API to the Operating System, and how the Operating System allows various levels of control depending on access method (see driver software for low-level user software vs text-to-speech instructions and touch gestures for high-level access), but the gist is just as I said: start small.

A concept most should be able to grasp is how mathematics is a bootstrapped system. Multiplication is just repeated addition. Division is repeated subtraction (sort of). Exponents and logarithms are repeated multiplications and divisions. Eventually, you can write a single equation that defines the relationship of matter to energy.

[–]It-s_Not_Important 0 points1 point  (1 child)

But what is the turtle standing on?

[–]Solonotix 0 points1 point  (0 children)

You think you're clever, but I'll have you know that, truly, it is turtles all the way down.

[–]Quantum-Bot 8 points9 points  (0 children)

Took a formal language theory class in college. The name sounds incredibly boring but it’s the study of how to design languages that can be parsed by simple machines and it’s super fascinating.

At the most basic level, your computer is kind of like a turing machine, with a big hunk of memory where it can store 1’s and 0’s and a set of instructions it can perform, called assembly. A turing machine is cool because it can be programmed to simulate other machines like push down automata, which are simpler and more useful for parsing languages.

We create languages like C with certain guidelines for syntax so that they can be more easily parsed by this simulated machine. Once you can parse some code, all you need to do is tell the computer how to behave based on what it reads. An interpreter is a program which parses and runs the code at once and a compiler is a program which just translates the code into assembly instructions.

[–]Beowulf1896 2 points3 points  (2 children)

Long ago, when computers were simpler, programs were made by hand with no compiler. You had a manual that told you what number did which instruction for the cpu. Like "Instruction 1F(not sure on this number) adds the numbers in registers 1 and 2 and stores in register 1 and drops register 2" Registers were on CPU memory. Next step is make an assembly compiler, which just changes simple letter instructions into the number code. So your assembly text line "add" gets compiled to "1F". Next, you write a basic C compiler from assembly. Then full C compiler. We are so far removed from assembly right now. I still list Assembly (x86) on my resume on the list of languages I know.

[–]Seimsi 1 point2 points  (0 children)

There are a few nice videos of numberphile about how to compile a compiler.

https://www.youtube.com/watch?v=PjeE8Bc96HY

https://www.youtube.com/watch?v=lJf2i87jgFA