Documente Academic
Documente Profesional
Documente Cultură
LANGUAGES
Dr. D. C. Kiran
Associate Professor
Department of
Computer Science & Engineering
PRINCIPLES OF PROGRAMMING LANGUAGES
Dr. D. C. Kiran
Department of Computer Science and Engineering
PRINCIPLES OF PROGRAMMING LANGUAGES
Topics To Be Covered
• Type
• Type Binding
• Type Expressions
• Type System
• Type Checking
PRINCIPLES OF PROGRAMMING LANGUAGES
Type System
4
PRINCIPLES OF PROGRAMMING LANGUAGES
Why Typing?
E1 E + T E
ET
TT*F E + T
TF
F id
T T * F
F(E)
F F id
id id
PRINCIPLES OF PROGRAMMING LANGUAGES
Static Type Binding
E1 E + T
ET
T1 T * F
E {24.2, real}
TF
F id {2,int} E + T {12.2, real}
F(E)
{place} id id {place}
PRINCIPLES OF PROGRAMMING LANGUAGES
How? :- Type Expression
Functions:
•Treat functions in a programming language as mapping
from a domain type D to a range type R.
•The type of a function can be denoted by the type
expression D→R where D are R type expressions.
•Ex: int→int represents the type of a function which takes
an int value as parameter, and its return type is also int.
PRINCIPLES OF PROGRAMMING LANGUAGES
Type Constructor
• Type equivalence
– When are the types of two values the same?
• Type compatibility
– When can a value of type A be used in a context that
expects type B?
• Type inference
– What is the type of an expression, given the types of the
operands?
PRINCIPLES OF PROGRAMMING LANGUAGES
Summary
• Type
• Type Binding
Static and Dynamic Type Binding
Polymorphic Type System
• Type Expression
Type Constructors: Array, Records, Pointers
• Why and Where Type System is used
• Type Checking
Equivalence
Compatibility
Inference
THANK YOU
Dr. D. C. Kiran
Department of Computer Science and Engineering
dckiran@pes.edu
9829935135