more on type checking
DESCRIPTION
More on Type Checking. Conversion and Coercion. Int C; A = 1.5 + C;. Overloading. An id binds to >1 semantic entity in same scope Pascal: f = f + 1 Fortran/PL1: + int or real addition Ada: A( i ) Many languages: function decls with different parameter numbers/types - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/1.jpg)
More on Type Checking
![Page 2: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/2.jpg)
Conversion and Coercion
Int C;A = 1.5 + C;
![Page 3: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/3.jpg)
Overloading• An id binds to >1 semantic entity in same scopePascal: f = f + 1Fortran/PL1: + int or real additionAda: A(i)Many languages: function decls with different parameter numbers/types
Why? What are the challenges in implementing overloaded id’s?
![Page 4: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/4.jpg)
Resolving overloaded symbols
• Determine unique meaning – use context• Operators (non-ids)• Ids
![Page 5: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/5.jpg)
Another example
![Page 6: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/6.jpg)
Overriding in Java
![Page 7: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/7.jpg)
Polymorphic Call Sites
![Page 8: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/8.jpg)
Polymorphic Functions:one function decl, multiple type args
![Page 9: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/9.jpg)
Polymorphism, Overloading, Overriding
![Page 10: More on Type Checking](https://reader036.vdocument.in/reader036/viewer/2022062222/56816690550346895dda69ef/html5/thumbnails/10.jpg)
Type Checking Summary
• Exercise:
• With a partner, Outline the main issues you need to know to implement a type checker.