Introduction To Programming Languages Compilers Interpreters and Assemblers
Introduction To Programming Languages Compilers Interpreters and Assemblers
Programming
Languages:
Compilers,
Interpreters, and
Assemblers
This presentation introduces the fundamental concepts of programming
languages, exploring the roles of compilers, interpreters, and assemblers in
translating human-readable code into machine-executable instructions.
by Aaditya Thakur
What is a Programming
Language?
1 Human-Readable 2 Abstraction of
Instructions Complexity
Programming languages Programming languages
allow programmers to provide a layer of abstraction,
programming needs .
Difference between Compiler and Interpreter
Compiler Interpreter
Translates the entire program into machine code at once. Executes the program line by line.
Creates an executable file that can be run independently. Does not create an executable file, relying on the interpreter to
run the code.
Typically used for high-performance applications and system
software. Often preferred for scripting languages and interactive
development.
How does a Compiler work?
1 Lexical Analysis
Breaks down the code into individual tokens, like keywords,
identifiers, and operators.
2 Syntax Analysis
Checks if the code follows the grammatical rules of the
programming language.
3 Semantic Analysis
Ensures the code makes logical sense and adheres to the
language's semantic rules.
4 Code Generation
Transforms the analyzed code into machine-readable
instructions, creating an executable file.
Advantages and Disadvantages of Compilers
Advantages Disadvantages
Suitable for large and complex programs Requires specific platform compatibility
How does an Interpreter work?
Read Code Line
1 The interpreter reads the source code line by line.
Analyze Line
2 It then analyzes the line to determine its meaning and structure.
Execute Line
3 The interpreter executes the analyzed line, performing the actions specified in the code.
Advantages and Disadvantages of Interpreters
Advantages Disadvantages
Hardware-Specific
Assembly language is typically specific to a particular type of
processor architecture.
Advantages and
Disadvantages of Assemblers
Advantages Disadvantages
Understanding Hardware
Having a basic understanding of computer hardware is crucial for effective
programming and optimization.