Permalink
Browse files

Merge branch 'master' of github.com:toothbrush/apa-proj2

  • Loading branch information...
2 parents 4031744 + cce66bf commit 97d7b02945938dfe857dba7504d2c70455899080 @rubendg rubendg committed Jul 8, 2011
Showing with 11 additions and 9 deletions.
  1. +4 −4 doc/main.tex
  2. +2 −2 src/APA2/AG/DataTypes.ag
  3. +5 −3 src/Components.hs
View
@@ -33,7 +33,7 @@ \section{Introduction}
This project aims to implement a tool which can do a control-flow analysis on a
lambda-calculus language with support for data structures. The focus is on
-lists%and pairs
+ lists%and pairs
, for now.
Control-flow analysis aims to determine for each function application, which
@@ -58,7 +58,7 @@ \section{Design}
grammar of the language. It is based on Haskell (in fact we use the Haskell
source extensions parser), but of course only a subset is supported.
-We include support for% pairs and
+We include support for % pairs and
lists, as well as a case statement in which one
can pattern-match on these data structures. There is not yet support for general
data structures.
@@ -426,7 +426,7 @@ \section{Features and Limitations}
Currently we only support a monovariant analysis. One of the most prominent issues
preventing us from fully implementing a polyvariant analysis was that it was not
-entirely clear yet how we should go about resolving constraints during the anlysis.
+entirely clear yet how we should go about resolving constraints during the analysis.
In addition, the role of the qualified type (or rather, qualified constraints)
was not completely clear either. While we did have support for quantifying over
annotation variables and generating several constraints on the quantified types,
@@ -437,7 +437,7 @@ \section{Features and Limitations}
constraints we should generate for it.
We are currently also missing support for pairs. Instead, we offer support for
-lists. While pairs pose the problem of potentially having two different types in
+ lists. While pairs pose the problem of potentially having two different types in
the pair, their fixed size would make them relatively straight-forward to implement.
Another limitation is that our case blocks only support exactly two alternatives.
View
@@ -129,7 +129,7 @@ tyAnn :: (Show a1, Show a) => a -> a1 -> [Char]
tyAnn t a = "(" ++ show t ++ ":" ++ show a ++ ")"
tyAnnCont :: Show a => Map AnnVar SAnn -> a -> AnnVar -> [Char]
-tyAnnCont con t a = "(" ++ show t ++ (colonOpt $ a `from` con)
+tyAnnCont con t a = "(" ++ show t ++ (colonOpt $ a `from` con) ++ ")"
colonOpt [] = ""
colonOpt xs = " : " ++ xs
@@ -147,7 +147,7 @@ instance Show Ty where
show (List t an) = "(List " ++ show t ++ ") " ++ (colonOpt $ show an)
tyLayout :: Map AnnVar SAnn -> Ty -> String
-tyLayout _ (TyVar a) = a
+tyLayout _ (TyVar a) = "" -- a - we probably don't want to see this here.
tyLayout con (Arr t a t' a') = tyAnnCont con t ((fromSAnn a) `from` con) ++ " ➔ " ++ tyAnnCont con t' ((fromSAnn a') `from` con)
tyLayout _ Nat = "Nat"
tyLayout _ Bool = "Bool"
View
@@ -55,7 +55,8 @@ debugInference tm =
putStrLn ""
putStrLn "Ty:"
let solved = worklist constraints
- putStrLn $ ("("++ tyLayout solved ty ++ ") :::: " ++ ((fromSAnn annotation) `from` solved))
+ let ty' = applySubst (solutionSubst constraints) (applySubst subst ty)
+ putStrLn $ ("("++ tyLayout solved ty' ++ ") :::: " ++ ((fromSAnn annotation) `from` solved))
putStrLn ""
putStrLn "Top level annotation: "
print annotation
@@ -74,7 +75,7 @@ debugInference tm =
printAnalysis solved
putStrLn ""
putStrLn "Expressions: "
- printExpressions solved (applySubst subst exprs)
+ printExpressions solved (applySubst (solutionSubst constraints) (applySubst subst exprs))
putStrLn ""
putStrLn debug
@@ -87,7 +88,8 @@ analysisResult tm =
print tm
putStrLn "Type of full program:\n"
let solved = worklist constraints
- putStrLn $ ("("++ tyLayout solved ty ++ ") :::: " ++ ((fromSAnn annotation) `from` solved))
+ let ty' = applySubst (solutionSubst constraints) (applySubst subst ty)
+ putStrLn $ ("("++ tyLayout solved ty' ++ ") :::: " ++ ((fromSAnn annotation) `from` solved))
putStrLn "\nMapping of program points to code: \n"
putStrLn (ppMap annots)
putStrLn "\nAnalysis result for all sub-expressions: \n"

0 comments on commit 97d7b02

Please sign in to comment.