+ 2

how code does work?

i want learn code

12th Aug 2024, 12:16 AM
Mcjuju
2 odpowiedzi
+ 4
If you're asking how code actually gets executed in a computer, here's a shorter explanation: Computers only understand binary language, i.e., 0's and 1's. When we write code in a high-level language (HLL) such as Python, Java, C++, or C#, it needs to be converted into machine (CPU) understandable instructions. This process typically involves the following steps: 1. Compilation: Source Code: The developer writes code in a high-level language. Compiler: A compiler is a special program that converts the source code into machine code. This process involves several stages: a. Lexical Analysis: The compiler breaks down the source code into tokens, which are the basic syntax elements (e.g., keywords, operators, identifiers). b. Syntax Analysis: The compiler checks the tokens against the language’s grammar rules to form a syntax tree, ensuring that the code is structurally correct. c. Semantic Analysis: The compiler verifies that the code makes sense in terms of variable declarations, type checking, and other language-specific rules. d. Optimization: The compiler may optimize the code for performance, reducing the number of instructions or improving memory usage. e. Code Generation: The compiler translates the syntax tree into intermediate code (often in assembly language), which is then converted into machine code (binary instructions) specific to the target CPU. 2. Linking: The linker resolves references between different pieces of code and combines them into a single executable file. 3. Loading: The operating system loads the executable into memory, preparing it for execution. At this point, the code has been converted into machine-understandable instructions. 4. Execution: The CPU fetches these instructions, decodes them, and executes the machine instructions generated by the compiler. This is how code written in a high-level language is executed by a CPU that only understands 0's and 1's.
12th Aug 2024, 6:31 AM
Mustafa Raza
0
"Code works by giving instructions to a computer to perform specific tasks. It’s the language that tells software how to function and respond." https://washingmachinerepairkuwait.com/ We repair and maintain any brands of Automatic washing machine In Kuwait, we have the most qualified washing machine technician and experts that are both Pakistani and Indian.
13th Aug 2024, 5:54 PM
Washing machine Kuwait
Washing machine Kuwait - avatar