โ† Compiler Design learning path
Compiler Design ยท Module 1 of 10

Introduction to compilers

What a compiler does and its phases.

๐Ÿ“– Key ideas

  1. A compiler translates a source program into a target program, usually machine code, and reports errors.
  2. An interpreter executes the source directly, statement by statement.
  3. Phases: lexical analysis, syntax analysis, semantic analysis, intermediate code, optimisation and code generation.
  4. The front end depends on the source language; the back end depends on the target machine.
  5. The symbol table and error handler are shared by all phases.
๐Ÿ’ก Real-life example: A compiler is like a translator who reads a whole book in Tamil and writes the English version; an interpreter translates a speech live, sentence by sentence.
CompilerTranslates a whole program to target code
InterpreterExecutes source statements directly
Front endPhases that depend on the source language
Symbol tableData structure storing identifiers and their attributes