Compiler Design (MCA554) Unit 1: Introduction to Compilers & Lexical Analysis
Unit 1: Introduction to Compilers & Lexical Analysis From your MCA Semester III syllabus. --- What is a Compiler? A Compiler is a software that translates a program written in a high-level language into machine language. Example: printf("Hello"); Compiler converts it into machine code that the computer understands. --- Language Translators 1. Compiler Converts the entire program at once. Source Program ↓ Compiler ↓ Object Code Advantages: Faster execution Errors shown after compilation Examples: C C++ Go --- 2. Interpreter Translates line by line. Source Program ↓ Interpreter ↓ Execute Line by Line Advantages: Easy debugging Disadvantages: Slower execution Examples: Python JavaScript --- 3. Assembler Converts Assembly Language to Machine Language. Assembly Code ↓ Assembler ↓ Machine Code --- Difference Between Compi...