CSE-321 Programming Languages Typechecking - PowerPoint PPT Presentation

About This Presentation
Title:

CSE-321 Programming Languages Typechecking

Description:

No type annotation in -abstraction. Some expression explicitly annotated. 14 ... uses an elimination rule. 24. Typing Rules for. Bidirectional Typechecking ... – PowerPoint PPT presentation

Number of Views:157
Avg rating:3.0/5.0
Slides: 25
Provided by: sungwo8
Category:

less

Transcript and Presenter's Notes

Title: CSE-321 Programming Languages Typechecking


1
CSE-321 Programming LanguagesTypechecking
???
  • POSTECH
  • May 3, 2006

2
Declarative Interpretation of ? e A
  • Input
  • ?
  • e
  • A
  • Output
  • Yes e has type A under ?.
  • No e does not have type A under ?.

3
Algorithmic Interpretation of ? e A
  • Input
  • ?
  • e
  • Output
  • A Yes, A is the type of e.
  • TypeError No, e has no type.

4
Outline
  • Purely synthetic typechecking
  • algorithmic interpretation only
  • essentially Assignment 5, Part I
  • Bidirectional typechecking

5
Implementation of the Type System
  • A new function typing

6
Function typing (1/2)
7
Function typing (2/2)
8
Algorithmic Typing Judgment
9
Algorithmic Typing Rules
10
Correctness
  • Soundness
  • Completeness

11
Outline
  • Purely synthetic typechecking V
  • Bidirectional typechecking
  • both declarative interpretation and algorithmic
    interpretation

12
Do we need bool?
13
Bidirectional Typechecking
  • No type annotation in ?-abstraction
  • Some expression explicitly annotated

14
Bidirectional Typechecking
  • Analysis phase
  • Synthesis phase

15
Which rule?
16
Analyze ? x. e
17
Which rule?
18
Synthesize for e e'
19
Variable
20
(No Transcript)
21
Can we infer the type of (e A) ?
  • Yes, it's A,but only if e indeed has type A.

22
Bidirectional Typechecking Rules
23
Intro and Elim Expressions
  • Intro expression I
  • always check I against a type A.
  • never infer its type.
  • uses an introduction rule.
  • Elim expression E
  • always infer its type.
  • never check E against a type A.
  • uses an elimination rule.

24
Typing Rules for Bidirectional Typechecking
Write a Comment
User Comments (0)
About PowerShow.com