@@ -84,8 +84,7 @@ show(io::IO, ::BotElement) = print(io, "⊥")
8484
8585# Part 3: dataflow analysis
8686
87- # Note: the paper uses U+1D56E MATHEMATICAL BOLD FRAKTUR CAPITAL C for this
88- typealias AbstractValue Dict{Symbol,LatticeElement}
87+ # Note: the paper (https://api.semanticscholar.org/CorpusID:28519618) uses U+1D56E MATHEMATICAL BOLD FRAKTUR CAPITAL C for this
8988const AbstractValue = Dict{Symbol,LatticeElement}
9089
9190# Here we extend lattices of values to lattices of mappings of variables
@@ -98,6 +97,10 @@ const AbstractValue = Dict{Symbol,LatticeElement}
9897<= (X:: AbstractValue , Y:: AbstractValue ) = X⊓ Y == X
9998< (X:: AbstractValue , Y:: AbstractValue ) = X<= Y && X!= Y
10099
100+ # Note: we solve an existential data-flow problem below, so:
101+ # - initialize states with `⊥` instead of `⊤`
102+ # - use `!<=` instead of `!<=` to check whether or not the instruction makes a change
103+ # - use `⊔` instead of `⊓` to update states
101104function max_fixed_point (P:: Program , a₁:: AbstractValue , eval) where {Program<: AbstractVector{Stmt} }
102105 n = length (P)
103106 bot = AbstractValue ( v => ⊥ for v in keys (a₁) )
146149struct IsDefined <: LatticeElement
147150 is:: Bool
148151end
152+ show (io:: IO , isdef:: IsDefined ) = print (io, isdef. is ? " defined" : " undefined" )
149153
150154const undef = IsDefined (false )
151155const def = IsDefined (true )
0 commit comments