What is Parsing?
Parsing is the process of analyzing the structure of source code to check syntax and build a structure (AST). AST (Abstract Syntax Tree) is a tree-like data structure that represents the logical structure of source code after parsing. AST = Structured representation of code. It removes unnecessary details (like brackets and semicolons) and keeps meaningful syntax.
if x > 5:
print(x)
# ✔ Syntax is correct → parsed successfully
# ❌ Missing : → parsing error
Why AST is called Abstract?
Because it does not store every symbol exactly as written — only what matters for understanding and execution.
For your example a = b + c * 2, the parser follows the Order of Operations (Multiplication before Addition): The Root (=): The assignment happens last. The Left Branch: The variable a where the result will be stored. The Right Branch (+): The sum of b and the result of the multiplication. The Leaf Nodes: The values c and 2 are multiplied first.
What is Compiling?
Compiling converts the entire program into machine code or bytecode before execution. Errors shown before running.
int x = 10;
//Machine code / executable
What is Interpreting?
Interpreting executes code line-by-line at runtime without creating a separate executable. Errors occur during execution.
print("Hello")
print(y)
# Hello
# NameError: y not defined
|
Language |
Parsed |
Compiled |
Interpreted |
Parsing Type |
Execution Speed |
|---|---|---|---|---|---|
|
C |
Yes |
Yes |
No |
Static, Top-down |
Very Fast |
|
C++ |
Yes |
Yes |
No |
Static, Top-down |
Very Fast |
|
Java |
Yes |
Yes (Bytecode) |
Yes (JVM) |
Static |
Fast |
|
Python |
Yes |
Yes (Bytecode) |
Yes |
Dynamic |
Slow |
|
JavaScript |
Yes |
JIT (Just-In-Time) |
Yes |
Dynamic |
Medium–Fast |
|
C# |
Yes |
Yes (IL) |
Yes (.NET CLR) |
Static |
Fast |
|
Go |
Yes |
Yes |
No |
Static |
Very Fast |
|
Rust |
Yes |
Yes |
No |
Static |
Very Fast |
|
Ruby |
Yes |
No |
Yes |
Dynamic |
Slow |
|
PHP |
Yes |
No |
Yes |
Dynamic |
Slow–Medium |
|
Swift |
Yes |
Yes |
No |
Static |
Fast |
|
Kotlin |
Yes |
Yes |
Yes (JVM) |
Static |
Fast |
|
R |
Yes |
No |
Yes |
Dynamic |
Slow |
|
MATLAB |
Yes |
No |
Yes |
Dynamic |
Slow |
|
Assembly |
No |
Yes |
No |
None |
Fastest |
|
HTML |
Yes |
No |
No |
Declarative |
N/A |
|
CSS |
Yes |
No |
No |
Declarative |
N/A |
|
SQL |
Yes |
No |
Yes (DB Engine) |
Declarative |
Fast (Engine-based) |
- JIT
JIT (Just-In-Time) Compilation is a technique where code is compiled at runtime, just before it is executed, instead of being fully compiled in advance.
JIT = Compile while running
It combines the benefits of compilers (speed) and interpreters (flexibility).
- .NET CLR
.NET CLR (Common Language Runtime) is the runtime environment of the .NET platform that executes programs written in .NET languages like C#, VB.NET, F#.
The CLR uses a JIT (Just-In-Time) compiler to convert .NET code into machine code at runtime.
- JVM
“Yes (JVM)” means that the language runs on the Java Virtual Machine and uses JIT compilation for execution.
The JVM is a runtime environment that:
- The language is compiled to bytecode
- The bytecode runs on the JVM
- The JVM uses JIT to convert bytecode into machine code at runtime
Languages like Java, Kotlin, Scala run on the JVM.