SlideShare uma empresa Scribd logo
1 de 96
Baixar para ler offline
IN4303 2014/15 
Compiler Construction 
Declarative Semantics Definition 
static analysis and error checking 
Guido Wachsmuth
Static Analysis and Error Checking 2 
source 
code
Static Analysis and Error Checking 2 
source 
code 
parse
Static Analysis and Error Checking 2 
source 
code 
errors 
parse 
check
parse generate 
Static Analysis and Error Checking 2 
source 
code 
check 
errors 
machine 
code
Static Analysis and Error Checking 3 
source 
code
Static Analysis and Error Checking 3 
source 
code 
parse
Static Analysis and Error Checking 3 
source 
code 
parse 
check
Static Analysis and Error Checking 3 
source 
code 
parse 
check
Static Analysis and Error Checking 3 
source 
code 
parse generate 
machine 
code 
check
Static Analysis and Error Checking 4 
static checking 
name analysis 
name binding and scope
Static Analysis and Error Checking 4 
static checking 
editor services 
name analysis 
name binding and scope
Static Analysis and Error Checking 4 
static checking 
editor services 
transformation 
name analysis 
name binding and scope
Static Analysis and Error Checking 4 
static checking 
editor services 
transformation 
refactoring 
name analysis 
name binding and scope
Static Analysis and Error Checking 4 
static checking 
editor services 
transformation 
refactoring 
code generation 
name analysis 
name binding and scope
SDF3 
NaBL 
TS 
Stratego 
ESV 
editor 
Static Analysis and Error Checking 
SPT 
tests 
5 
syntax definition 
concrete syntax 
abstract syntax 
static semantics 
name binding 
type system 
dynamic semantics 
translation 
interpretation
SDF3 
NaBL 
TS 
Stratego 
ESV 
editor 
Static Analysis and Error Checking 
SPT 
tests 
6 
syntax definition 
concrete syntax 
abstract syntax 
static semantics 
name binding 
type system 
dynamic semantics 
translation 
interpretation
Static Analysis and Error Checking 7 
formal semantics 
type system 
name binding 
testing 
name binding 
type system 
constraints 
specification 
name binding 
type system 
constraints
formal semantics 
Static Analysis and Error Checking 8 
static semantics
theoretical computer science 
Static Analysis and Error Checking 9 
word problem χL: Σ*→ {0,1} 
w → 1, if w∈L 
w → 0, else 
decidability & complexity
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 9 
word problem χL: Σ*→ {0,1} 
w → 1, if w∈L 
w → 0, else 
decidability 
type-0: semi-decidable 
type-1, type-2, type-3: decidable
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 9 
word problem χL: Σ*→ {0,1} 
w → 1, if w∈L 
w → 0, else 
decidability 
type-0: semi-decidable 
type-1, type-2, type-3: decidable 
complexity 
type-1: PSPACE-complete 
type-2, type-3: P
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 9 
word problem χL: Σ*→ {0,1} 
w → 1, if w∈L 
w → 0, else 
decidability 
type-0: semi-decidable 
type-1, type-2, type-3: decidable 
complexity 
type-1: PSPACE-complete 
type-2, type-3: P 
PSPACE⊇NP⊇P
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 10 
formal grammars 
context-sensitive 
context-free 
regular
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 10 
formal grammars 
context-sensitive 
context-free 
regular
theoretical computer science 
decidability & complexity 
Static Analysis and Error Checking 10 
formal grammars 
context-sensitive 
context-free 
regular
/* factorial function */ 
! 
let 
! 
var x := 0 
! 
function fact(n : int) : int = 
if n < 1 then 1 else (n * fact(n - 1)) 
! 
in 
! 
for i := 1 to 3 do ( 
x := x + fact(i); 
printint(x); 
print(" ") 
) 
! 
end 
Static Analysis and Error Checking 11
#include <stio.h> 
! 
/* factorial function */ 
! 
int fac(int num) { 
if (num < 1) 
Static Analysis and Error Checking 12 
return 1; 
else 
return num * fac(num - 1); 
} 
! 
int main() { 
printf(“%d! = %dn”, 10, fac(10)); 
return 0; 
}
class Main { 
! 
public static void main(String[] args) { 
System.out.println(new Fac().fac(10)); 
} 
} 
! 
class Fac { 
! 
public int fac(int num) { 
int num_aux; 
if (num < 1) 
num_aux = 1; 
else 
num_aux = num * this.fac(num - 1); 
return num_aux; 
} 
} 
Static Analysis and Error Checking 13
Static Analysis and Error Checking 14 
static semantics 
restricting context-free languages 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w}
restricting context-free languages 
Static Analysis and Error Checking 14 
static semantics 
context-free superset 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w}
restricting context-free languages 
Static Analysis and Error Checking 14 
static semantics 
context-free superset 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w}
restricting context-free languages 
Static Analysis and Error Checking 14 
static semantics 
context-free superset 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w} 
static semantics 
L = {w∈ L(G) | ⊢ w}
restricting context-free languages 
Static Analysis and Error Checking 14 
static semantics 
context-free superset 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w} 
static semantics 
L = {w∈ L(G) | ⊢ w} 
judgements 
well-formed ⊢ w 
well-typed E ⊢ e : t
restricting context-free languages 
Static Analysis and Error Checking 14 
static semantics 
context-free superset 
context-sensitive 
language 
context-free grammar 
L(G) = {w∈Σ* | S ⇒G* w} 
static semantics 
L = {w∈ L(G) | ⊢ w} 
judgements 
well-formed ⊢ w 
well-typed E ⊢ e : t
formal semantics 
Static Analysis and Error Checking 15 
type systems
Tiger 
type system 
Static Analysis and Error Checking 16 
E ⊢ i : int 
E ⊢ s : string 
E ⊢ nil : ⊥
Tiger 
type system 
Static Analysis and Error Checking 17 
E ⊢ () : ∅ 
E ⊢ e1 : t1 
E ⊢ e2 : t2 
E ⊢ e1 ; e2 : t2
Tiger 
type system 
E ⊢ e1 : array of t 
E ⊢ e2 : int 
E ⊢ e1[e2] : t 
Static Analysis and Error Checking 18 
E ⊢ e1 : int 
E ⊢ e2 : int 
E ⊢ e1 + e2 : int 
E ⊢ e1 : int 
E ⊢ e2 : int 
E ⊢ e1 < e2 : int 
E ⊢ e1 : string 
E ⊢ e2 : string 
E ⊢ e1 < e2 : int
Tiger 
type system 
E ⊢ e1 : t1 
E ⊢ e2 : t2 
t1 ≅ t2 
E ⊢ e1 = e2 : int 
t1 <: t2 
t1 ≅ t2 
t2 <: t1 
t1 ≅ t2 
t ≠ ∅ 
t ≅ t 
Static Analysis and Error Checking 19 
⊥<: {f1, …, fn} 
⊥<: array of t
Tiger 
type system 
Static Analysis and Error Checking 20 
E ⊢ e1 : t1 
E ⊢ e2 : t2 
t1 ≅ t2 
E ⊢ e1 := e2 : ∅ 
E ⊢ e1 : int 
E ⊢ e2 : t1 
E ⊢ e3 : t2 
E ⊢ if e1 then e2 else e3: sup<: {t1, t2}
formal semantics 
Static Analysis and Error Checking 21 
name binding
Tiger 
scoping 
Static Analysis and Error Checking 22 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Tiger 
scoping 
Static Analysis and Error Checking 22 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Tiger 
scoping 
Static Analysis and Error Checking 22 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Tiger 
scoping 
Static Analysis and Error Checking 22 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Tiger 
scoping 
Static Analysis and Error Checking 22 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Tiger 
variable names 
E ⊢ e1 : t1 
t ≅ t1 
E ⊕ v ↦ t ⊢ e2 : t2 
E ⊢ let var v : t = e1 in e2: t2 
Static Analysis and Error Checking 23 
E(v) = t 
E ⊢ v : t
Tiger 
function names 
E ⊕ v1 ↦ t1 ,…, vn ↦ tn ⊢ e1 : tf 
E ⊕ f ↦ t1 × … × tn → tf ⊢ e2 : t 
E ⊢ let 
function f (v1 : t1, …, vn : tn) = e1 
in e2: t 
E(f) = t1 × … × tn → tf 
e1 : t1 
… 
en : tn 
E ⊢ f (e1, …, en) : t 
Static Analysis and Error Checking 24
Static Analysis and Error Checking 25 
testing
Static Analysis and Error Checking 26 
test outer name [[ 
let type t = u 
Testing 
name binding 
type [[u]] = int 
var x: [[u]] := 0 
in 
x := 42 ; 
let type u = t 
var y: u := 0 
in 
y := 42 
end 
end 
]] resolve #2 to #1 
test inner name [[ 
let type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let type [[u]] = t 
var y: [[u]] := 0 
in 
y := 42 
end 
end 
]] resolve #2 to #1
Static Analysis and Error Checking 27 
test integer constant [[ 
let type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let type u = t 
var y: u := 0 
in 
y := [[42]] 
end 
Testing 
type system 
end 
]] run get-type to IntTy() 
test variable reference [[ 
let type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let type u = t 
var y: u := 0 
in 
y := [[x]] 
end 
end 
]] run get-type to IntTy()
Static Analysis and Error Checking 28 
Testing 
constraints 
test undefined variable [[ 
let type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let type u = t 
var y: u := 0 
in 
y := [[z]] 
end 
end 
]] 1 error 
test type error [[ 
let type t = u 
type u = string 
var x: u := 0 
in 
x := 42 ; 
let type u = t 
var y: u := 0 
in 
y := [[x]] 
end 
end 
]] 1 error
Static Analysis and Error Checking 29 
testing 
static semantics 
context-free superset 
language
specification 
Static Analysis and Error Checking 30 
name binding
Name Binding Language 
Static Analysis and Error Checking 31 
concepts 
defines 
! 
refers 
! 
namespaces 
! 
scopes 
! 
imports
Name Binding Language 
definitions and references 
Static Analysis and Error Checking 32 
TypeDec(t, _): 
defines Type t 
Tid(t) : 
refers to Type t 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 33 
unique definitions 
TypeDec(t, _): 
defines unique Type t 
Tid(t) : 
refers to Type t 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 34 
namespaces 
let 
type mt = int 
type rt = {f1: string, f2: int} 
type at = array of int 
! 
var x := 42 
var y: int := 42 
! 
function p() = print("foo") 
function sqr(x: int): int = x*x 
in 
… 
end 
namespaces 
Type Variable Function 
! 
TypeDec(t, _): 
defines unique Type t 
! 
FunDec(f, _, _): 
defines unique Function f 
FunDec(f, _, _, _): 
defines unique Function f 
Call(f, _) : 
refers to Function f 
! 
VarDec(v, _): 
defines unique Variable v 
FArg(a, _): 
defines unique Variable a 
Var(v): 
refers to Variable v
Name Binding Language 
Static Analysis and Error Checking 35 
scopes 
FunDec(f, _, _): 
defines unique Function f 
scopes Variable 
! 
FunDec(f, _, _, _): 
defines unique Function f 
scopes Variable 
Let(_, _): 
scopes Type, Function, Variable 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 35 
scopes 
FunDec(f, _, _): 
defines unique Function f 
scopes Variable 
! 
FunDec(f, _, _, _): 
defines unique Function f 
scopes Variable 
Let(_, _): 
scopes Type, Function, Variable 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 35 
scopes 
FunDec(f, _, _): 
defines unique Function f 
scopes Variable 
! 
FunDec(f, _, _, _): 
defines unique Function f 
scopes Variable 
Let(_, _): 
scopes Type, Function, Variable 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 35 
scopes 
FunDec(f, _, _): 
defines unique Function f 
scopes Variable 
! 
FunDec(f, _, _, _): 
defines unique Function f 
scopes Variable 
Let(_, _): 
scopes Type, Function, Variable 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 35 
scopes 
FunDec(f, _, _): 
defines unique Function f 
scopes Variable 
! 
FunDec(f, _, _, _): 
defines unique Function f 
scopes Variable 
Let(_, _): 
scopes Type, Function, Variable 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end
Name Binding Language 
Static Analysis and Error Checking 36 
definition scopes 
For(v, start, end, body): for x := 0 to 42 do x; 
defines Variable v in body
Static Analysis and Error Checking 37 
Spoofax 
bound renaming 
let 
type t = u 
type u = int 
var x: u := 0 
in 
x := 42 ; 
let 
type u = t 
var y: u := 0 
in 
y := 42 
end 
end 
let 
type t0 = u0 
type u0 = int 
var x: u0 := 0 
in 
x := 42 ; 
let 
type u1 = t0 
var y: u1 := 0 
in 
y := 42 
end 
end
Static Analysis and Error Checking 38 
Spoofax 
annotated terms 
t{t1, ..., tn} 
! 
! 
! 
add additional information to a term but preserve its signature
specification 
Static Analysis and Error Checking 39 
type system
Static Analysis and Error Checking 40 
TS 
axioms 
type rules 
! 
Int(_) : IntTy() 
String(_): StringTy() 
! 
signatures 
! 
NilTy: Type 
type rules 
! 
Nil(): NilTy() 
E ⊢ i : int 
E ⊢ s : string 
E ⊢ nil : ⊥
Static Analysis and Error Checking 41 
TS 
inference rules 
type rules 
! 
Add(e1,e2): IntTy() 
where e1: ty1 
and ty1 == IntTy() 
and e2: ty2 
and ty2 == IntTy() 
E ⊢ e1 : int 
E ⊢ e2 : int 
E ⊢ e1 + e2 : int
Static Analysis and Error Checking 42 
TS 
inference rules 
type rules 
! 
Lt(e1,e2): IntTy() 
where e1: ty1 
and e2: ty2 
and ( ( ty1 == IntTy() and ty2 == IntTy() ) 
or ( ty1 == StringTy() and ty2 == StringTy() ) 
) 
E ⊢ e1 : int 
E ⊢ e2 : int 
E ⊢ e1 < e2 : int 
E ⊢ e1 : string 
E ⊢ e2 : string 
E ⊢ e1 < e2 : int
defines unique Variable x 
of type ty 
Static Analysis and Error Checking 43 
NaBL and TS 
interaction 
binding rules 
! 
VarDec(x, ty): 
type rules 
! 
Var(x): ty 
where definition of x: ty
Static Analysis and Error Checking 44 
NaBL and TS 
interaction 
FArg(a, t): 
defines unique Variable a of type t 
! 
FunDec(f, a*, e): 
defines unique Function f of type (t*, t) 
where a* has type t* 
and e has type t 
! 
Call(f, a*) : 
refers to Function f of type (t*, _) 
where a* has type t*
specification 
Static Analysis and Error Checking 45 
constraints
Static Analysis and Error Checking 46 
TS 
type errors 
type rules 
! 
Add(e1,e2): IntTy() 
where e1: ty1 
and ty1 == IntTy() 
else error "…" on e1 
and e2: ty2 
and ty2 == IntTy() 
else error "…" on e2 
E ⊢ e1 : int 
E ⊢ e2 : int 
E ⊢ e1 + e2 : int
Static Analysis and Error Checking 47 
TS 
missing definitions 
type rules 
! 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))])
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2)
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))])
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))])
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Che4c8king 48 
Spoofax 
origin tracking 
let var x := 21 in y * 2 end 
Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) 
desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) 
Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) 
Var(x): ty 
where definition of x: ty 
else error "…" on x
Static Analysis and Error Checking 49 
derivation of editor services 
error checking 
reference resolution 
code completion 
Spoofax 
static analysis
Static Analysis and Error Checking 49 
derivation of editor services 
error checking 
reference resolution 
code completion 
multi-file analysis 
Spoofax 
static analysis
Static Analysis and Error Checking 49 
derivation of editor services 
error checking 
reference resolution 
code completion 
multi-file analysis 
parallel analysis 
Spoofax 
static analysis
Static Analysis and Error Checking 49 
derivation of editor services 
error checking 
reference resolution 
code completion 
multi-file analysis 
parallel analysis 
incremental analysis 
Spoofax 
static analysis
Except where otherwise noted, this work is licensed under 
Static Analysis and Error Checking 50
Static Analysis and Error Checking 51 
attribution 
slide title author license 
1 Inspection Kent Wien CC BY-NC 2.0 
2, 3 PICOL icons Melih Bilgil CC BY 3.0 
10 Noam Chomsky Maria Castelló Solbes CC BY-NC-SA 2.0 
11, 16-20, 22-24 Tiger Bernard Landgraf CC BY-SA 3.0 
12 The C Programming Language Bill Bradford CC BY 2.0 
13 Italian Java book cover

Mais conteúdo relacionado

Mais procurados

Pure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and RegainedPure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and RegainedGuido Wachsmuth
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesGuido Wachsmuth
 
Static name resolution
Static name resolutionStatic name resolution
Static name resolutionEelco Visser
 
Declare Your Language: Syntactic (Editor) Services
Declare Your Language: Syntactic (Editor) ServicesDeclare Your Language: Syntactic (Editor) Services
Declare Your Language: Syntactic (Editor) ServicesEelco Visser
 
Declare Your Language: Type Checking
Declare Your Language: Type CheckingDeclare Your Language: Type Checking
Declare Your Language: Type CheckingEelco Visser
 
Dynamic Semantics Specification and Interpreter Generation
Dynamic Semantics Specification and Interpreter GenerationDynamic Semantics Specification and Interpreter Generation
Dynamic Semantics Specification and Interpreter GenerationEelco Visser
 
Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing Eelco Visser
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler DesignAkhil Kaushik
 
regular expressions (Regex)
regular expressions (Regex)regular expressions (Regex)
regular expressions (Regex)Rebaz Najeeb
 
Declare Your Language (at DLS)
Declare Your Language (at DLS)Declare Your Language (at DLS)
Declare Your Language (at DLS)Eelco Visser
 

Mais procurados (20)

Term Rewriting
Term RewritingTerm Rewriting
Term Rewriting
 
LL Parsing
LL ParsingLL Parsing
LL Parsing
 
Pure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and RegainedPure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and Regained
 
Syntax Definition
Syntax DefinitionSyntax Definition
Syntax Definition
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented Languages
 
Dynamic Semantics
Dynamic SemanticsDynamic Semantics
Dynamic Semantics
 
Static name resolution
Static name resolutionStatic name resolution
Static name resolution
 
Declare Your Language: Syntactic (Editor) Services
Declare Your Language: Syntactic (Editor) ServicesDeclare Your Language: Syntactic (Editor) Services
Declare Your Language: Syntactic (Editor) Services
 
Declare Your Language: Type Checking
Declare Your Language: Type CheckingDeclare Your Language: Type Checking
Declare Your Language: Type Checking
 
Ch04
Ch04Ch04
Ch04
 
Type analysis
Type analysisType analysis
Type analysis
 
Dynamic Semantics Specification and Interpreter Generation
Dynamic Semantics Specification and Interpreter GenerationDynamic Semantics Specification and Interpreter Generation
Dynamic Semantics Specification and Interpreter Generation
 
Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing Compiler Construction | Lecture 4 | Parsing
Compiler Construction | Lecture 4 | Parsing
 
Ch03
Ch03Ch03
Ch03
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Ch06
Ch06Ch06
Ch06
 
Regular expression examples
Regular expression examplesRegular expression examples
Regular expression examples
 
Ch4a
Ch4aCh4a
Ch4a
 
regular expressions (Regex)
regular expressions (Regex)regular expressions (Regex)
regular expressions (Regex)
 
Declare Your Language (at DLS)
Declare Your Language (at DLS)Declare Your Language (at DLS)
Declare Your Language (at DLS)
 

Destaque

PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...
PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...
PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...Rommel Carvalho
 
Similarity Measures for Semantic Relation Extraction
Similarity Measures for Semantic Relation ExtractionSimilarity Measures for Semantic Relation Extraction
Similarity Measures for Semantic Relation ExtractionAlexander Panchenko
 
New strategies for teacher training 2
New strategies for teacher training 2New strategies for teacher training 2
New strategies for teacher training 2ksa
 
The good language teacher
The good language teacherThe good language teacher
The good language teacherFayez Habbal
 
Types of errors
Types of errorsTypes of errors
Types of errorsRima fathi
 
Error analysis presentation
Error analysis presentationError analysis presentation
Error analysis presentationGeraldine Lopez
 
Branches of linguistics
Branches of linguisticsBranches of linguistics
Branches of linguisticsApurv Verma
 

Destaque (9)

PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...
PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...
PrOntoLearn: Unsupervised Lexico-Semantic Ontology Generation using Probabili...
 
Similarity Measures for Semantic Relation Extraction
Similarity Measures for Semantic Relation ExtractionSimilarity Measures for Semantic Relation Extraction
Similarity Measures for Semantic Relation Extraction
 
New strategies for teacher training 2
New strategies for teacher training 2New strategies for teacher training 2
New strategies for teacher training 2
 
The good language teacher
The good language teacherThe good language teacher
The good language teacher
 
Error analysis revised
Error analysis revisedError analysis revised
Error analysis revised
 
Types of errors
Types of errorsTypes of errors
Types of errors
 
Error analysis presentation
Error analysis presentationError analysis presentation
Error analysis presentation
 
Branches of linguistics
Branches of linguisticsBranches of linguistics
Branches of linguistics
 
Applied linguistics
Applied linguisticsApplied linguistics
Applied linguistics
 

Semelhante a Declarative Semantics Definition - Static Analysis and Error Checking

Declare Your Language: Name Resolution
Declare Your Language: Name ResolutionDeclare Your Language: Name Resolution
Declare Your Language: Name ResolutionEelco Visser
 
The TclQuadcode Compiler
The TclQuadcode CompilerThe TclQuadcode Compiler
The TclQuadcode CompilerDonal Fellows
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaPRAVEENTALARI4
 
Model-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error CheckingModel-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error CheckingEelco Visser
 
Ejercicios de estilo en la programación
Ejercicios de estilo en la programaciónEjercicios de estilo en la programación
Ejercicios de estilo en la programaciónSoftware Guru
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingEelco Visser
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionEelco Visser
 
Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppthenokmetaferia1
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Languagevsssuresh
 
Software analysis and testing
Software analysis and testing Software analysis and testing
Software analysis and testing NishaVatwani
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARDTia Ricci
 

Semelhante a Declarative Semantics Definition - Static Analysis and Error Checking (20)

Declare Your Language: Name Resolution
Declare Your Language: Name ResolutionDeclare Your Language: Name Resolution
Declare Your Language: Name Resolution
 
Ch6.ppt
Ch6.pptCh6.ppt
Ch6.ppt
 
The TclQuadcode Compiler
The TclQuadcode CompilerThe TclQuadcode Compiler
The TclQuadcode Compiler
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
 
Ch3
Ch3Ch3
Ch3
 
Ch6
Ch6Ch6
Ch6
 
C tutorial
C tutorialC tutorial
C tutorial
 
Ch2
Ch2Ch2
Ch2
 
Model-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error CheckingModel-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error Checking
 
Ejercicios de estilo en la programación
Ejercicios de estilo en la programaciónEjercicios de estilo en la programación
Ejercicios de estilo en la programación
 
Ch2 (1).ppt
Ch2 (1).pptCh2 (1).ppt
Ch2 (1).ppt
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
C program compiler presentation
C program compiler presentationC program compiler presentation
C program compiler presentation
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
 
Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppt
 
core java
 core java core java
core java
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Software analysis and testing
Software analysis and testing Software analysis and testing
Software analysis and testing
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARD
 

Mais de Guido Wachsmuth

Domain-Specific Type Systems
Domain-Specific Type SystemsDomain-Specific Type Systems
Domain-Specific Type SystemsGuido Wachsmuth
 
Declarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty PrintingDeclarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty PrintingGuido Wachsmuth
 
Compiler Components and their Generators - LR Parsing
Compiler Components and their Generators - LR ParsingCompiler Components and their Generators - LR Parsing
Compiler Components and their Generators - LR ParsingGuido Wachsmuth
 
Compiling Imperative and Object-Oriented Languages - Garbage Collection
Compiling Imperative and Object-Oriented Languages - Garbage CollectionCompiling Imperative and Object-Oriented Languages - Garbage Collection
Compiling Imperative and Object-Oriented Languages - Garbage CollectionGuido Wachsmuth
 
Compiling Imperative and Object-Oriented Languages - Register Allocation
Compiling Imperative and Object-Oriented Languages - Register AllocationCompiling Imperative and Object-Oriented Languages - Register Allocation
Compiling Imperative and Object-Oriented Languages - Register AllocationGuido Wachsmuth
 
Compiling Imperative and Object-Oriented Languages - Dataflow Analysis
Compiling Imperative and Object-Oriented Languages - Dataflow AnalysisCompiling Imperative and Object-Oriented Languages - Dataflow Analysis
Compiling Imperative and Object-Oriented Languages - Dataflow AnalysisGuido Wachsmuth
 
Compiling Imperative and Object-Oriented Languages - Activation Records
Compiling Imperative and Object-Oriented Languages - Activation RecordsCompiling Imperative and Object-Oriented Languages - Activation Records
Compiling Imperative and Object-Oriented Languages - Activation RecordsGuido Wachsmuth
 
Declarative Semantics Definition - Code Generation
Declarative Semantics Definition - Code Generation Declarative Semantics Definition - Code Generation
Declarative Semantics Definition - Code Generation Guido Wachsmuth
 

Mais de Guido Wachsmuth (10)

Language
LanguageLanguage
Language
 
Domain-Specific Type Systems
Domain-Specific Type SystemsDomain-Specific Type Systems
Domain-Specific Type Systems
 
Declarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty PrintingDeclarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty Printing
 
Compiler Components and their Generators - LR Parsing
Compiler Components and their Generators - LR ParsingCompiler Components and their Generators - LR Parsing
Compiler Components and their Generators - LR Parsing
 
Compiling Imperative and Object-Oriented Languages - Garbage Collection
Compiling Imperative and Object-Oriented Languages - Garbage CollectionCompiling Imperative and Object-Oriented Languages - Garbage Collection
Compiling Imperative and Object-Oriented Languages - Garbage Collection
 
Compiling Imperative and Object-Oriented Languages - Register Allocation
Compiling Imperative and Object-Oriented Languages - Register AllocationCompiling Imperative and Object-Oriented Languages - Register Allocation
Compiling Imperative and Object-Oriented Languages - Register Allocation
 
Compiling Imperative and Object-Oriented Languages - Dataflow Analysis
Compiling Imperative and Object-Oriented Languages - Dataflow AnalysisCompiling Imperative and Object-Oriented Languages - Dataflow Analysis
Compiling Imperative and Object-Oriented Languages - Dataflow Analysis
 
Compiling Imperative and Object-Oriented Languages - Activation Records
Compiling Imperative and Object-Oriented Languages - Activation RecordsCompiling Imperative and Object-Oriented Languages - Activation Records
Compiling Imperative and Object-Oriented Languages - Activation Records
 
Declarative Semantics Definition - Code Generation
Declarative Semantics Definition - Code Generation Declarative Semantics Definition - Code Generation
Declarative Semantics Definition - Code Generation
 
Software Languages
Software LanguagesSoftware Languages
Software Languages
 

Último

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Último (20)

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 

Declarative Semantics Definition - Static Analysis and Error Checking

  • 1. IN4303 2014/15 Compiler Construction Declarative Semantics Definition static analysis and error checking Guido Wachsmuth
  • 2. Static Analysis and Error Checking 2 source code
  • 3. Static Analysis and Error Checking 2 source code parse
  • 4. Static Analysis and Error Checking 2 source code errors parse check
  • 5. parse generate Static Analysis and Error Checking 2 source code check errors machine code
  • 6. Static Analysis and Error Checking 3 source code
  • 7. Static Analysis and Error Checking 3 source code parse
  • 8. Static Analysis and Error Checking 3 source code parse check
  • 9. Static Analysis and Error Checking 3 source code parse check
  • 10. Static Analysis and Error Checking 3 source code parse generate machine code check
  • 11. Static Analysis and Error Checking 4 static checking name analysis name binding and scope
  • 12. Static Analysis and Error Checking 4 static checking editor services name analysis name binding and scope
  • 13. Static Analysis and Error Checking 4 static checking editor services transformation name analysis name binding and scope
  • 14. Static Analysis and Error Checking 4 static checking editor services transformation refactoring name analysis name binding and scope
  • 15. Static Analysis and Error Checking 4 static checking editor services transformation refactoring code generation name analysis name binding and scope
  • 16. SDF3 NaBL TS Stratego ESV editor Static Analysis and Error Checking SPT tests 5 syntax definition concrete syntax abstract syntax static semantics name binding type system dynamic semantics translation interpretation
  • 17. SDF3 NaBL TS Stratego ESV editor Static Analysis and Error Checking SPT tests 6 syntax definition concrete syntax abstract syntax static semantics name binding type system dynamic semantics translation interpretation
  • 18. Static Analysis and Error Checking 7 formal semantics type system name binding testing name binding type system constraints specification name binding type system constraints
  • 19. formal semantics Static Analysis and Error Checking 8 static semantics
  • 20. theoretical computer science Static Analysis and Error Checking 9 word problem χL: Σ*→ {0,1} w → 1, if w∈L w → 0, else decidability & complexity
  • 21. theoretical computer science decidability & complexity Static Analysis and Error Checking 9 word problem χL: Σ*→ {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable
  • 22. theoretical computer science decidability & complexity Static Analysis and Error Checking 9 word problem χL: Σ*→ {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable complexity type-1: PSPACE-complete type-2, type-3: P
  • 23. theoretical computer science decidability & complexity Static Analysis and Error Checking 9 word problem χL: Σ*→ {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable complexity type-1: PSPACE-complete type-2, type-3: P PSPACE⊇NP⊇P
  • 24. theoretical computer science decidability & complexity Static Analysis and Error Checking 10 formal grammars context-sensitive context-free regular
  • 25. theoretical computer science decidability & complexity Static Analysis and Error Checking 10 formal grammars context-sensitive context-free regular
  • 26. theoretical computer science decidability & complexity Static Analysis and Error Checking 10 formal grammars context-sensitive context-free regular
  • 27. /* factorial function */ ! let ! var x := 0 ! function fact(n : int) : int = if n < 1 then 1 else (n * fact(n - 1)) ! in ! for i := 1 to 3 do ( x := x + fact(i); printint(x); print(" ") ) ! end Static Analysis and Error Checking 11
  • 28. #include <stio.h> ! /* factorial function */ ! int fac(int num) { if (num < 1) Static Analysis and Error Checking 12 return 1; else return num * fac(num - 1); } ! int main() { printf(“%d! = %dn”, 10, fac(10)); return 0; }
  • 29. class Main { ! public static void main(String[] args) { System.out.println(new Fac().fac(10)); } } ! class Fac { ! public int fac(int num) { int num_aux; if (num < 1) num_aux = 1; else num_aux = num * this.fac(num - 1); return num_aux; } } Static Analysis and Error Checking 13
  • 30. Static Analysis and Error Checking 14 static semantics restricting context-free languages context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w}
  • 31. restricting context-free languages Static Analysis and Error Checking 14 static semantics context-free superset context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w}
  • 32. restricting context-free languages Static Analysis and Error Checking 14 static semantics context-free superset context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w}
  • 33. restricting context-free languages Static Analysis and Error Checking 14 static semantics context-free superset context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w} static semantics L = {w∈ L(G) | ⊢ w}
  • 34. restricting context-free languages Static Analysis and Error Checking 14 static semantics context-free superset context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w} static semantics L = {w∈ L(G) | ⊢ w} judgements well-formed ⊢ w well-typed E ⊢ e : t
  • 35. restricting context-free languages Static Analysis and Error Checking 14 static semantics context-free superset context-sensitive language context-free grammar L(G) = {w∈Σ* | S ⇒G* w} static semantics L = {w∈ L(G) | ⊢ w} judgements well-formed ⊢ w well-typed E ⊢ e : t
  • 36. formal semantics Static Analysis and Error Checking 15 type systems
  • 37. Tiger type system Static Analysis and Error Checking 16 E ⊢ i : int E ⊢ s : string E ⊢ nil : ⊥
  • 38. Tiger type system Static Analysis and Error Checking 17 E ⊢ () : ∅ E ⊢ e1 : t1 E ⊢ e2 : t2 E ⊢ e1 ; e2 : t2
  • 39. Tiger type system E ⊢ e1 : array of t E ⊢ e2 : int E ⊢ e1[e2] : t Static Analysis and Error Checking 18 E ⊢ e1 : int E ⊢ e2 : int E ⊢ e1 + e2 : int E ⊢ e1 : int E ⊢ e2 : int E ⊢ e1 < e2 : int E ⊢ e1 : string E ⊢ e2 : string E ⊢ e1 < e2 : int
  • 40. Tiger type system E ⊢ e1 : t1 E ⊢ e2 : t2 t1 ≅ t2 E ⊢ e1 = e2 : int t1 <: t2 t1 ≅ t2 t2 <: t1 t1 ≅ t2 t ≠ ∅ t ≅ t Static Analysis and Error Checking 19 ⊥<: {f1, …, fn} ⊥<: array of t
  • 41. Tiger type system Static Analysis and Error Checking 20 E ⊢ e1 : t1 E ⊢ e2 : t2 t1 ≅ t2 E ⊢ e1 := e2 : ∅ E ⊢ e1 : int E ⊢ e2 : t1 E ⊢ e3 : t2 E ⊢ if e1 then e2 else e3: sup<: {t1, t2}
  • 42. formal semantics Static Analysis and Error Checking 21 name binding
  • 43. Tiger scoping Static Analysis and Error Checking 22 let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 44. Tiger scoping Static Analysis and Error Checking 22 let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 45. Tiger scoping Static Analysis and Error Checking 22 let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 46. Tiger scoping Static Analysis and Error Checking 22 let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 47. Tiger scoping Static Analysis and Error Checking 22 let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 48. Tiger variable names E ⊢ e1 : t1 t ≅ t1 E ⊕ v ↦ t ⊢ e2 : t2 E ⊢ let var v : t = e1 in e2: t2 Static Analysis and Error Checking 23 E(v) = t E ⊢ v : t
  • 49. Tiger function names E ⊕ v1 ↦ t1 ,…, vn ↦ tn ⊢ e1 : tf E ⊕ f ↦ t1 × … × tn → tf ⊢ e2 : t E ⊢ let function f (v1 : t1, …, vn : tn) = e1 in e2: t E(f) = t1 × … × tn → tf e1 : t1 … en : tn E ⊢ f (e1, …, en) : t Static Analysis and Error Checking 24
  • 50. Static Analysis and Error Checking 25 testing
  • 51. Static Analysis and Error Checking 26 test outer name [[ let type t = u Testing name binding type [[u]] = int var x: [[u]] := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end ]] resolve #2 to #1 test inner name [[ let type t = u type u = int var x: u := 0 in x := 42 ; let type [[u]] = t var y: [[u]] := 0 in y := 42 end end ]] resolve #2 to #1
  • 52. Static Analysis and Error Checking 27 test integer constant [[ let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := [[42]] end Testing type system end ]] run get-type to IntTy() test variable reference [[ let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := [[x]] end end ]] run get-type to IntTy()
  • 53. Static Analysis and Error Checking 28 Testing constraints test undefined variable [[ let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := [[z]] end end ]] 1 error test type error [[ let type t = u type u = string var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := [[x]] end end ]] 1 error
  • 54. Static Analysis and Error Checking 29 testing static semantics context-free superset language
  • 55. specification Static Analysis and Error Checking 30 name binding
  • 56. Name Binding Language Static Analysis and Error Checking 31 concepts defines ! refers ! namespaces ! scopes ! imports
  • 57. Name Binding Language definitions and references Static Analysis and Error Checking 32 TypeDec(t, _): defines Type t Tid(t) : refers to Type t let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 58. Name Binding Language Static Analysis and Error Checking 33 unique definitions TypeDec(t, _): defines unique Type t Tid(t) : refers to Type t let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 59. Name Binding Language Static Analysis and Error Checking 34 namespaces let type mt = int type rt = {f1: string, f2: int} type at = array of int ! var x := 42 var y: int := 42 ! function p() = print("foo") function sqr(x: int): int = x*x in … end namespaces Type Variable Function ! TypeDec(t, _): defines unique Type t ! FunDec(f, _, _): defines unique Function f FunDec(f, _, _, _): defines unique Function f Call(f, _) : refers to Function f ! VarDec(v, _): defines unique Variable v FArg(a, _): defines unique Variable a Var(v): refers to Variable v
  • 60. Name Binding Language Static Analysis and Error Checking 35 scopes FunDec(f, _, _): defines unique Function f scopes Variable ! FunDec(f, _, _, _): defines unique Function f scopes Variable Let(_, _): scopes Type, Function, Variable let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 61. Name Binding Language Static Analysis and Error Checking 35 scopes FunDec(f, _, _): defines unique Function f scopes Variable ! FunDec(f, _, _, _): defines unique Function f scopes Variable Let(_, _): scopes Type, Function, Variable let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 62. Name Binding Language Static Analysis and Error Checking 35 scopes FunDec(f, _, _): defines unique Function f scopes Variable ! FunDec(f, _, _, _): defines unique Function f scopes Variable Let(_, _): scopes Type, Function, Variable let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 63. Name Binding Language Static Analysis and Error Checking 35 scopes FunDec(f, _, _): defines unique Function f scopes Variable ! FunDec(f, _, _, _): defines unique Function f scopes Variable Let(_, _): scopes Type, Function, Variable let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 64. Name Binding Language Static Analysis and Error Checking 35 scopes FunDec(f, _, _): defines unique Function f scopes Variable ! FunDec(f, _, _, _): defines unique Function f scopes Variable Let(_, _): scopes Type, Function, Variable let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end
  • 65. Name Binding Language Static Analysis and Error Checking 36 definition scopes For(v, start, end, body): for x := 0 to 42 do x; defines Variable v in body
  • 66. Static Analysis and Error Checking 37 Spoofax bound renaming let type t = u type u = int var x: u := 0 in x := 42 ; let type u = t var y: u := 0 in y := 42 end end let type t0 = u0 type u0 = int var x: u0 := 0 in x := 42 ; let type u1 = t0 var y: u1 := 0 in y := 42 end end
  • 67. Static Analysis and Error Checking 38 Spoofax annotated terms t{t1, ..., tn} ! ! ! add additional information to a term but preserve its signature
  • 68. specification Static Analysis and Error Checking 39 type system
  • 69. Static Analysis and Error Checking 40 TS axioms type rules ! Int(_) : IntTy() String(_): StringTy() ! signatures ! NilTy: Type type rules ! Nil(): NilTy() E ⊢ i : int E ⊢ s : string E ⊢ nil : ⊥
  • 70. Static Analysis and Error Checking 41 TS inference rules type rules ! Add(e1,e2): IntTy() where e1: ty1 and ty1 == IntTy() and e2: ty2 and ty2 == IntTy() E ⊢ e1 : int E ⊢ e2 : int E ⊢ e1 + e2 : int
  • 71. Static Analysis and Error Checking 42 TS inference rules type rules ! Lt(e1,e2): IntTy() where e1: ty1 and e2: ty2 and ( ( ty1 == IntTy() and ty2 == IntTy() ) or ( ty1 == StringTy() and ty2 == StringTy() ) ) E ⊢ e1 : int E ⊢ e2 : int E ⊢ e1 < e2 : int E ⊢ e1 : string E ⊢ e2 : string E ⊢ e1 < e2 : int
  • 72. defines unique Variable x of type ty Static Analysis and Error Checking 43 NaBL and TS interaction binding rules ! VarDec(x, ty): type rules ! Var(x): ty where definition of x: ty
  • 73. Static Analysis and Error Checking 44 NaBL and TS interaction FArg(a, t): defines unique Variable a of type t ! FunDec(f, a*, e): defines unique Function f of type (t*, t) where a* has type t* and e has type t ! Call(f, a*) : refers to Function f of type (t*, _) where a* has type t*
  • 74. specification Static Analysis and Error Checking 45 constraints
  • 75. Static Analysis and Error Checking 46 TS type errors type rules ! Add(e1,e2): IntTy() where e1: ty1 and ty1 == IntTy() else error "…" on e1 and e2: ty2 and ty2 == IntTy() else error "…" on e2 E ⊢ e1 : int E ⊢ e2 : int E ⊢ e1 + e2 : int
  • 76. Static Analysis and Error Checking 47 TS missing definitions type rules ! Var(x): ty where definition of x: ty else error "…" on x
  • 77. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end
  • 78. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))])
  • 79. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2)
  • 80. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))])
  • 81. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))])
  • 82. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 83. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 84. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 85. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 86. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 87. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 88. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 89. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 90. Static Analysis and Error Che4c8king 48 Spoofax origin tracking let var x := 21 in y * 2 end Let([VarDec("x", Int("21"))], [Times(Var("y"), Int("2"))]) desugar: Times(e1, e2) -> Bop(MUL(), e1, e2) Let([VarDec("x", Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Let([VarDec("x"{"…"}, Int("21"))], [Bop(MUL(), Var("y"), Int("2"))]) Var(x): ty where definition of x: ty else error "…" on x
  • 91. Static Analysis and Error Checking 49 derivation of editor services error checking reference resolution code completion Spoofax static analysis
  • 92. Static Analysis and Error Checking 49 derivation of editor services error checking reference resolution code completion multi-file analysis Spoofax static analysis
  • 93. Static Analysis and Error Checking 49 derivation of editor services error checking reference resolution code completion multi-file analysis parallel analysis Spoofax static analysis
  • 94. Static Analysis and Error Checking 49 derivation of editor services error checking reference resolution code completion multi-file analysis parallel analysis incremental analysis Spoofax static analysis
  • 95. Except where otherwise noted, this work is licensed under Static Analysis and Error Checking 50
  • 96. Static Analysis and Error Checking 51 attribution slide title author license 1 Inspection Kent Wien CC BY-NC 2.0 2, 3 PICOL icons Melih Bilgil CC BY 3.0 10 Noam Chomsky Maria Castelló Solbes CC BY-NC-SA 2.0 11, 16-20, 22-24 Tiger Bernard Landgraf CC BY-SA 3.0 12 The C Programming Language Bill Bradford CC BY 2.0 13 Italian Java book cover

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. feedback loop\n
  5. feedback loop\n
  6. feedback loop\n
  7. feedback loop\n
  8. feedback loop\n
  9. restrictions on production rules =&gt; grammar classes\n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. round-up on every lecture\n\nwhat to take with you\n\ncheck yourself, pre- and post-paration\n
  94. \n
  95. \n