This commit is contained in:
parent
072c4f48c4
commit
346151125e
6 changed files with 21 additions and 16 deletions
|
@ -20,7 +20,6 @@ A more advanced control-flow analysis consists of building the control-flow grap
|
|||
This time, instead of methods, the nodes represent instructions, and the edges indicate which instruction can follow which instruction.
|
||||
@fig:bg-fizzbuzz-cg-cfg c) represents the control-flow graph of @fig:bg-fizzbuzz-cg-cfg a), with code statements instead of bytecode instructions.
|
||||
|
||||
#todo[Add alt text for @fig:bg-fizzbuzz-cg and @fig:bg-fizzbuzz-cfg]
|
||||
|
||||
#figure({
|
||||
set align(center)
|
||||
|
@ -57,7 +56,7 @@ This time, instead of methods, the nodes represent instructions, and the edges i
|
|||
}
|
||||
```,
|
||||
width: 40%,
|
||||
alt: "",
|
||||
alt: "An oriented graph with arrows going from \"fizzBuzz(int)\" to \"Buzzer.fizzBuzz()\", \"Buzzer.fizz()\", \"String.valueOf(int)\", and \"Log.e(String, String)\"",
|
||||
),
|
||||
supplement: none,
|
||||
kind: "bg-fizzbuzz-cg-cfg subfig",
|
||||
|
@ -99,7 +98,16 @@ This time, instead of methods, the nodes represent instructions, and the edges i
|
|||
"l9": `Log.e("fizzbuzz", String.valueOf(i));`,
|
||||
),
|
||||
width: 50%,
|
||||
alt: "",
|
||||
alt: (
|
||||
"An oriented graph. ",
|
||||
"The node at the top is labelled `for (int i = 1; i <= n; i++) {`. Arrows go from it to the node below, labelled `if (i % 3 == 0 && i % 5 == 0) {`. ",
|
||||
"Two arrows start from this node, one to `Buzzer.fizzBuzz();`, one to `} else if (i % 3 == 0) {`. ",
|
||||
"An arrow goes from `Buzzer.fizzBuzz();` to the `for` node at the top. ",
|
||||
"Two arrows go from the `else if i % 5 = 0` node, one to `} else if (i % 5 == 0) {` and one to `Buzzer.fizz();`. ",
|
||||
"An arrow goes from `Buzzer.fizz();` to the `for` node at the top. ",
|
||||
"Two arrows go from the `else if i % 5 = 0`, one to `Buzzer.buzz();`, and one to `Log.e(\"fizzbuzz\", String.valueOf(i));`. ",
|
||||
"Arrows go from both those nodes, back to the `for` node at the top."
|
||||
).join(),
|
||||
),
|
||||
supplement: none,
|
||||
kind: "bg-fizzbuzz-cg-cfg subfig",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue