added section 3.2 and part of 3.3; changed language to en-GB

This commit is contained in:
Carlos Galindo 2019-12-04 15:47:37 +00:00
parent 59722faa7b
commit 80acb5243e
16 changed files with 174 additions and 235 deletions

View file

@ -1,22 +1,29 @@
digraph g {
"f()" [shape=box, rank=min];
"f()" [shape=box, rank=min, style = filled];
// Rank adjustment
{ node [style=filled]
{ rank = same; "int a = 1"; "while (a > 0)"; }
"if (a > 10)"; break;
}
{ rank = same; "print(a)"; "a++"; }
{ rank = max; "a++"; "print(a)"; }
"a++" [style="filled,bold"];
// Control flow
"f()" -> "int a = 1" [style=bold];
"f()" -> "while (a > 0)" [style=bold];
"while (a > 0)" -> "if (a > 10)" [style=bold];
"if (a > 10)" -> "break" [style=bold];
"break" -> "print(a)" [style=bold];
"break" -> "a++" [style=bold];
"break" -> "while (a > 0)" [style=bold];
"f()" -> "while (a > 0)";
"f()" -> "int a = 1";
"while (a > 0)" -> "if (a > 10)";
"if (a > 10)" -> "break";
"break" -> "print(a)";
"break" -> "a++";
"break" -> "while (a > 0)";
// Data flow
"int a = 1" -> "while (a > 0)" [color=red];
"int a = 1" -> "if (a > 10)" [color=red];
"int a = 1" -> "print(a)" [color=red];
"a++" -> "a++" -> "while (a > 0)" [color=red];
"a++" -> "if (a > 10)" [color=red];
"a++" -> "print(a)" [color=red];
{ edge [color = red];
"int a = 1" -> "while (a > 0)";
"int a = 1" -> "if (a > 10)";
"int a = 1" -> "print(a)";
"a++" -> "a++";
"a++" -> "while (a > 0)";
"a++" -> "if (a > 10)";
"a++" -> "print(a)" [constraint = true];
}
}

Binary file not shown.

View file

@ -1,8 +1,21 @@
digraph g {
Start [shape=box];
Start [shape=box,label=<Start<br/>x = x_in>];
End [shape=box];
Start -> End [style=dashed];
Start -> "if (x < 0)" -> "throw" -> "Error exit" -> End;
"throw" -> "return Math.sqrt(x)" [style=dashed];
"if (x < 0)" -> "return Math.sqrt(x)" -> "Normal exit" -> End;
}
// pdg
f [label="f()",shape=rect];
x_in [label = "x = x_in", style = dashed];
if [label = "if (x < 0)"];
t [label = "throw"];
ret [label = "return Math.sqrt(x)"];
ee [label = "error exit", style = dashed];
ne [label = "normal exit", style = dashed];
f -> x_in;
f -> if -> t -> {ret ee ne};
{ edge [color = red, constraint = false];
x_in -> {if ret};
}
}

Binary file not shown.