Compiler Design CAT
Compiler Design CAT
CAT
5. Classifications of a Compiler:
(i).Single-Pass vs Multi-Pass.
Single-Pass Compiler:
Processes the source code in one pass without revisiting earlier
stages.
Faster but less optimized.
Example: Early Pascal compilers.
Multi-Pass Compiler:
Processes the source code in multiple passes, refining the code
at each stage.
Enables better optimization and error handling.
Example: GCC (GNU Compiler Collection).
(ii).Just-In-Time (JIT) Compilation.-
Compiles code at runtime instead of beforehand.
Improves execution speed by optimizing frequently used code
segments.
Used in Java Virtual Machine (JVM), .NET CLR, and modern
JavaScript engines (V8, SpiderMonkey).
8. Architecture of a Compiler:
Source Code
Lexical
analyzer
Syntax
Analyzer
Semantic
analyzer
Optimizer
Code
Generator
9. Peephole Optimization:
-A small code segment optimization technique.
- Eliminates redundant instructions.