+ 1

How does computer interpret code written in any programming language? What parts are triggered inside computer ?

12th Nov 2017, 8:35 PM
Aniket Parab
Aniket Parab - avatar
8 odpowiedzi
+ 6
Two hours later, I've nothing to do, so here's more informative answer (it uses all the characters available here): There are so called "levels" of programming languages, more strictly — levels of abstraction. The higher the level, the farther the language is from the machine code. A computer can only execute it's machine code, which is a stream of ones and zeros. There is also an assembly language — a readable representation for machine codes. For example, here's a machine code, that will output a '!' character to the screen in DOS: "101101000000001010110010001000011100110100100001", and here's the assembly: "mov ah, 0x02 \n mov dl, 0x21 \n int 0x21". The assembly language is "translated" to the machine code by the program called assembler. An instruction in pure assembly language represents exact instruction of the computer. To abstract away from the machine, make code portable, and more readable, higher level languages have been created. Keywords and statements of high level languages have almost nothing to do with the machine code, but rather represent constructs, that are easy for humans to work with. A high level language is "translated" to the machine code, using a program called compiler. The remainder of the question is about how the machine code gets executed by a computer. And this topic is very broad and deep. Broad, because there are a lot of computer architectures, and each one is quite complex. A datasheet for current Intel processor, that describes it's functions is two volumes 650 pages in total. And deep, because this topic covers few levels of abstraction in the computer architecture and few levels of electronics and circuit design. And that's not even touching the peripheral devices and data interpretation. Here are few computer simulators you can play with (read the help), maybe it will help you understand the workflow inside a CPU: https://peterhigginson.co.uk/LMC http://www.peterhigginson.co.uk/RISC https://schweigi.github.io/assembler-simulator http://www.teach-sim.com
13th Nov 2017, 12:24 AM
deFault
+ 4
Ehm... They taught me the answer for your question for 5 years in the university. And you want to get it in one comment? Short answer will be kind of useless, bur here you go: >> How does a computer interpret code written in any programming language? - it uses a program, called interpreter, or compiler, or assembler. Depends on the type of the language. Sometimes, a virtual machine may be involved in the process. >> What parts are triggered inside a computer? - They are actually called triggers. They store one bit of information.
12th Nov 2017, 10:40 PM
deFault
+ 3
Paul, your answer is completely wrong. The code is converted into unintelligible machine code. Assembly is a completely normal language.
12th Nov 2017, 9:38 PM
Private [GER]
Private [GER] - avatar
+ 3
ugh, sorry, guess i still have to learn. thanks for pointing that out Private
12th Nov 2017, 11:11 PM
Paul
+ 3
@Private [GER], Computer Engineering. Didn't work a single day in this field though.
14th Nov 2017, 8:25 PM
deFault
+ 2
cpu only execute low level programing language, binary machine codes. so high level programing language make this "low" simple
12th Nov 2017, 9:26 PM
Andika Romansyah
+ 2
To expand on Marvin's answer: A good way to train Assembly is also SHENZHEN I/O.
13th Nov 2017, 3:48 PM
Private [GER]
Private [GER] - avatar
+ 1
Oh, one question to you Marvin. What did you study? CS?
14th Nov 2017, 8:10 PM
Private [GER]
Private [GER] - avatar