PROGRAMMIN
G LANGUAGE
BASICS
N. MOUNIKA
22H51A62A6
Introduction
to
Programming
Languages
• A programming language is a formal system
of communication used to instruct a
computer.
• Compiler Design involves translating high-
level language into machine code for
execution.
• Programming languages form the input to
the compiler, making their structure crucial
in compilation.
Classification of Programming Languages
Low-Level Languages:
• Machine Language: Binary representation, directly executed by hardware.
• Assembly Language: Uses mnemonics; requires an assembler.
High-Level Languages:
• Example: C, Java, Python
• Abstracts hardware details, easier for humans to write.
Middle-Level Languages:
• Example: C, C++
• Balance between hardware control and abstraction.
Programming Language
Paradigms
Imperative Object-Oriented
Paradigm: Paradigm:
Ex: C, Ex: Java, C++
Pascal
Uses step-by-step Based on objects
procedures and and classes.
functions.
Functional Logic
Paradigm: Paradigm:
Ex: Haskell, Ex: Prolog
Lisp
Uses mathematical Uses logical
functions, avoids inference and rules
mutable state. for problem-solving.
Syntax and
Semantics of
Programming
Languages
• Syntax: Defi nes the structure and rules of
the language.
• Example: Grammar, tokens, parsing rules.
• Semantics: Defi nes the meaning of
programs written in the language.
• Example: What a statement or expression
does.
Example:
• Syntax: int x = 10; (Correct syntax)
• Semantics: Assigns value 10 to x.
Role of
Programming
Languages in
Compiler Design
• Lexical Analysis: Tokenization of
source code.
• Syntax Analysis: Checking the
structure of the code.
• Semantic Analysis: Ensuring correct
meaning.
• Intermediate Code Generation:
Converts source code to an
intermediate representation.
• Optimization: Improves code
efficiency.
• Code Generation: Produces machine
code.
EXAMPLES OF PROGRAMMING
LANGUAGES USED IN COMPILER
CONSTRUCTION
C & C+ PYTHON:
+:
Used to develop
compilers (e.g.,
Used in compiler
prototyping
GCC). (e.g., PyPy).
LISP LLVM:
:
Early compiler
research.
A modern
framework
compiler
supporting multiple
languages.
Conclusion
• Programming languages form the basis of
compiler design.
• Understanding language structure helps in
effi cient compilation.
• Diff erent paradigms and syntax rules impact
compiler construction.
• Advances in programming languages continue
to improve compiler effi ciency.
Thank you
very much!