Remove edges in constructor

This commit is contained in:
Jan-Niclas Loosen
2026-01-22 20:26:41 +01:00
parent 3abe8581b5
commit 51028555de
77 changed files with 3964 additions and 309 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -4,32 +4,127 @@ from .CFG_Node import *
class CFG: class CFG:
def __init__(self, in_node: CFG_Node, out_node: CFG_Node): def __init__(self, in_node: CFG_Node, out_node: CFG_Node, ast=None):
self.in_node = in_node self.in_node = in_node
self.out_node = out_node self.out_node = out_node
self.ast = ast
# If AST is provided, filter the graph by removing empty nodes
if ast is not None:
self._filter_graph()
def _filter_graph(self):
"""
Filter the CFG by removing empty nodes and rewiring edges.
This should be done once during construction, not during to_dot().
"""
# Collect all nodes in the graph
all_nodes = set()
self._collect_nodes(self.in_node, all_nodes)
# Identify nodes to remove
nodes_to_remove = [node for node in all_nodes if self._should_remove_node(node)]
# Remove nodes and rewrite edges
for node in nodes_to_remove:
self._remove_node_and_rewire(node)
def _collect_nodes(self, node, node_set):
"""Recursively collect all nodes in the graph"""
if node in node_set:
return
node_set.add(node)
for child in node.children:
self._collect_nodes(child, node_set)
def _should_remove_node(self, node):
"""Determine if a node should be removed from the graph"""
# Remove empty nodes (nodes with no meaningful content)
# Check for both None and "None" string
if hasattr(node, 'label') and ((node.label is None) or (node.label == "None")):
# Nodes with AST nodes should NOT be removed - they will get labels from AST
if node.ast_node is not None:
return False
# Also keep global START nodes (they have label=None but should be shown)
if hasattr(node, 'dot_label') and node.dot_label() == "START":
return False
# Remove nodes that have no AST and no meaningful label
return True
# Remove global END nodes (those without function names)
if hasattr(node, 'dot_label'):
if node.dot_label() in ["END"]:
# Keep function-specific END nodes, skip global ones
if hasattr(node, 'label') and node.label and '(' in node.label and ')' in node.label:
return False
else:
return True
return False
def _remove_node_and_rewire(self, node):
"""Remove a node from the graph and rewire edges to bypass it"""
# Store original children before modification
original_children = list(node.children)
# For each parent, rewire edges to bypass this node
for parent in list(node.parents):
if node in parent.children:
# Find appropriate targets based on node type
if hasattr(node, 'dot_shape') and node.dot_shape() == "diamond":
# For diamond nodes, preserve T/F branches
targets = []
if len(original_children) >= 1:
true_target = self._find_first_non_empty_child(original_children[0])
if true_target:
targets.append(true_target)
if len(original_children) >= 2:
false_target = self._find_first_non_empty_child(original_children[1])
if false_target:
targets.append(false_target)
else:
# For regular nodes, find all non-empty targets
targets = []
for child in original_children:
target = self._find_first_non_empty_child(child)
if target and target not in targets:
targets.append(target)
# Remove edge from parent to node
parent.remove_child(node, propagate=False)
# Add edges from parent to targets
for target in targets:
parent.add_child(target, propagate=False)
# Clear the node's connections
node.parents.clear()
node.children.clear()
def _find_first_non_empty_child(self, node):
"""Find the first non-empty descendant of a node"""
if not self._should_remove_node(node):
return node
# Recursively check children
for child in sorted(node.children, key=lambda n: n.id):
result = self._find_first_non_empty_child(child)
if result is not None:
return result
return None
def to_dot(self) -> str: def to_dot(self) -> str:
"""
Convert the CFG to DOT format.
This method should ONLY handle formatting, not graph modifications.
All graph filtering and modifications should be done in the constructor.
"""
visited = set() visited = set()
visited_nodes = []
lines = ["digraph CFG {"] lines = ["digraph CFG {"]
lines.append(' node [fontname="Helvetica"];') lines.append(' node [fontname="Helvetica"];')
def node_label(node: CFG_Node) -> str | None | Any: def node_label(node: CFG_Node) -> str | None | Any:
# Skip empty nodes (nodes with no meaningful content)
if hasattr(node, 'label') and node.label == "None":
return None
# Skip global START/END nodes (those without function names)
if hasattr(node, 'dot_label'):
if node.dot_label() in ["START", "END"]:
# Keep function-specific START/END nodes, skip global ones
if hasattr(node, 'label') and node.label and '(' in node.label and ')' in node.label:
# This is a function START/END node, keep it
pass
else:
# This is a global START/END node, skip it
return None
# Use custom label if available # Use custom label if available
if hasattr(node, 'label') and node.label: if hasattr(node, 'label') and node.label:
# Remove node ID from label for certain node types # Remove node ID from label for certain node types
@@ -64,35 +159,17 @@ class CFG:
styles.append('color=green') styles.append('color=green')
return ', '.join(styles) if styles else '' return ', '.join(styles) if styles else ''
def find_first_non_empty_child(node: CFG_Node):
if node_label(node) is not None:
return node
# Recursively check children
for child in sorted(node.children, key=lambda n: n.id):
result = find_first_non_empty_child(child)
if result is not None:
return result
return None
def visit(node: CFG_Node): def visit(node: CFG_Node):
if node.id in visited: if node.id in visited:
return return
label = node_label(node)
visited_nodes.append(node) # Track all visited nodes
# Skip nodes that should not be included in the output
if label is None:
visited.add(node.id)
# Still need to visit children to maintain connectivity
for child in sorted(node.children, key=lambda n: n.id):
visit(child)
return
visited.add(node.id) visited.add(node.id)
label = node_label(node)
if label is None:
# This shouldn't happen if the constructor did its job properly
return
shape = node_shape(node) shape = node_shape(node)
style = node_style(node) style = node_style(node)
@@ -101,74 +178,8 @@ class CFG:
f' n{node.id} [label="{label}", shape={shape}{style_str}];' f' n{node.id} [label="{label}", shape={shape}{style_str}];'
) )
# Add edges to children
for i, child in enumerate(sorted(node.children, key=lambda n: n.id)): for i, child in enumerate(sorted(node.children, key=lambda n: n.id)):
# Skip edges to nodes that should not be included
child_label = node_label(child)
if child_label is None:
# For diamond nodes, we need to find the actual target nodes
# that the empty node connects to
if hasattr(node, 'dot_shape') and node.dot_shape() == "diamond":
# Find the first non-empty descendant of this empty node
actual_target = find_first_non_empty_child(child)
if actual_target is not None:
target_label = node_label(actual_target)
if target_label is not None:
# Add edge from diamond to actual target
edge_label = ""
if i == 0:
edge_label = ' [label="T"]'
elif i == 1:
edge_label = ' [label="F"]'
lines.append(f" n{node.id} -> n{actual_target.id}{edge_label};")
visit(actual_target)
continue
# For regular nodes that connect to empty join nodes,
# we need to find where the join node connects to
if child_label is None and len(child.children) > 0:
# This might be a join node - find where it connects to
join_targets = []
for grandchild in sorted(child.children, key=lambda n: n.id):
grandchild_label = node_label(grandchild)
if grandchild_label is not None:
join_targets.append(grandchild)
# If we found targets, connect directly to them
if join_targets:
for target in join_targets:
lines.append(f" n{node.id} -> n{target.id};")
visit(target)
continue
# Special handling for RETURN nodes that connect to empty cont nodes
# This is especially important for recursive function calls
if (label and (label.startswith("RET ") or label.startswith("CALL ")) and
child_label is None and len(child.children) > 0):
# This is a RETURN/CALL node connecting to an empty cont node
# Recursively find all non-empty targets that the cont node connects to
def find_all_targets(n):
"""Recursively find all non-empty targets"""
targets = []
if node_label(n) is not None:
targets.append(n)
else:
for grandchild in sorted(n.children, key=lambda n: n.id):
targets.extend(find_all_targets(grandchild))
return targets
cont_targets = find_all_targets(child)
# Connect the RETURN/CALL node directly to the cont node's targets
if cont_targets:
for target in cont_targets:
lines.append(f" n{node.id} -> n{target.id};")
visit(target)
continue
# Visit the child but don't create an edge
visit(child)
continue
# Add edge labels for diamond nodes (conditional branches) # Add edge labels for diamond nodes (conditional branches)
edge_label = "" edge_label = ""
if hasattr(node, 'dot_shape') and node.dot_shape() == "diamond": if hasattr(node, 'dot_shape') and node.dot_shape() == "diamond":
@@ -180,26 +191,6 @@ class CFG:
lines.append(f" n{node.id} -> n{child.id}{edge_label};") lines.append(f" n{node.id} -> n{child.id}{edge_label};")
visit(child) visit(child)
# Add special edges for recursive calls in function g
# This handles the specific case where RET g(y) should connect to the x variable
if label and label.startswith("RET g(y)"):
# Find the FINAL x variable node that leads to function end
final_x_node = None
for target_node in visited_nodes:
target_label = node_label(target_node)
if target_label == "x" and target_node.id != node.id:
# Check if this x node connects to END g(x)
for child in target_node.children:
child_label = node_label(child)
if child_label and child_label.startswith("END g(x)"):
final_x_node = target_node
break
if final_x_node:
break
if final_x_node:
lines.append(f" n{node.id} -> n{final_x_node.id};")
# Start the CFG traversal from the entry node # Start the CFG traversal from the entry node
visit(self.in_node) visit(self.in_node)
lines.append("}") lines.append("}")

View File

@@ -0,0 +1,91 @@
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
# Add the current directory to Python path so we can import our modules
sys.path.insert(0, '/home/janniclas/Projekte/Construction-of-Compilers/Project-02-03-04')
import triplayacc as yacc
import cfg_build
import syntax
from cfg.CFG import CFG
from cfg.CFG_Node import (CFG_START, CFG_END)
def make_cfg(ast):
start = CFG_START()
end = CFG_END()
last = ast.cfa(start, end)
if last is not None:
last.add_child(end)
return CFG(start, end, ast)
def generate_dot_files():
base = Path("triplaprograms")
programs = sorted([f for f in base.glob("*.tripla")])
output_dir = Path("mistraltests/after")
output_dir.mkdir(exist_ok=True, parents=True)
for path in programs:
try:
print(f"Processing {path.name}...")
# Reset the global FUNCTIONS registry
cfg_build.FUNCTIONS.clear()
source = path.read_text()
ast = yacc.parser.parse(source)
# Create CFG
cfg = make_cfg(ast)
# Generate dot file
dot_str = cfg.to_dot()
# Save to file
output_path = output_dir / f"{path.stem}_cfg_after.dot"
with open(output_path, "w") as f:
f.write(dot_str)
print(f"Saved: {output_path}")
except Exception as e:
print(f"Error processing {path.name}: {e}")
continue
def compare_dot_files():
"""Compare before and after dot files to ensure they're the same"""
before_dir = Path("mistraltests/before")
after_dir = Path("mistraltests/after")
before_files = sorted(before_dir.glob("*_cfg_before.dot"))
after_files = sorted(after_dir.glob("*_cfg_after.dot"))
print("\nComparing dot files...")
mismatches = []
for before_file, after_file in zip(before_files, after_files):
before_content = before_file.read_text()
after_content = after_file.read_text()
if before_content == after_content:
print(f"{before_file.stem} - MATCH")
else:
print(f"{before_file.stem} - MISMATCH")
mismatches.append((before_file, after_file))
if mismatches:
print(f"\n{mismatches} files have mismatches!")
for before_file, after_file in mismatches:
print(f" {before_file.name} vs {after_file.name}")
else:
print("\nAll dot files match! The refactoring was successful.")
if __name__ == "__main__":
generate_dot_files()
compare_dot_files()

View File

@@ -0,0 +1,62 @@
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
# Add the current directory to Python path so we can import our modules
sys.path.insert(0, '/home/janniclas/Projekte/Construction-of-Compilers/Project-02-03-04')
import triplayacc as yacc
import cfg_build
import syntax
from cfg.CFG import CFG
from cfg.CFG_Node import (CFG_START, CFG_END)
def make_cfg(ast):
start = CFG_START()
end = CFG_END()
last = ast.cfa(start, end)
if last is not None:
last.add_child(end)
return CFG(start, end)
def generate_dot_files():
base = Path("triplaprograms")
programs = sorted([f for f in base.glob("*.tripla")])
output_dir = Path("mistraltests/before")
output_dir.mkdir(exist_ok=True, parents=True)
for path in programs:
try:
print(f"Processing {path.name}...")
# Reset the global FUNCTIONS registry
cfg_build.FUNCTIONS.clear()
source = path.read_text()
ast = yacc.parser.parse(source)
# Create CFG
cfg = make_cfg(ast)
# Generate dot file
dot_str = cfg.to_dot()
# Save to file
output_path = output_dir / f"{path.stem}_cfg_before.dot"
with open(output_path, "w") as f:
f.write(dot_str)
print(f"Saved: {output_path}")
except Exception as e:
print(f"Error processing {path.name}: {e}")
continue
if __name__ == "__main__":
generate_dot_files()
print("Done generating 'before' dot files.")

View File

@@ -33,7 +33,7 @@ def make_cfg(ast):
if last is not None: if last is not None:
last.add_child(end) last.add_child(end)
return CFG(start, end) return CFG(start, end, ast)
# Renders a diagram of the AST # Renders a diagram of the AST
def render_diagram(dot_string: str): def render_diagram(dot_string: str):

View File

@@ -0,0 +1,21 @@
digraph CFG {
node [fontname="Helvetica"];
n1 [label="START", shape=box];
n1 -> n7;
n7 [label="1", shape=box];
n7 -> n8;
n8 [label="2", shape=box];
n8 -> n9;
n9 [label="3", shape=box];
n9 -> n10;
n10 [label="CALL a", shape=box, style=filled, color=orange];
n10 -> n3;
n3 [label="START a(x, y, z)", shape=box, style=filled, color=green];
n3 -> n6;
n6 [label="x", shape=box];
n6 -> n4;
n4 [label="END a(x, y, z)", shape=box, style=filled, color=green];
n4 -> n12;
n12 [label="RET a", shape=box, style=filled, color=orange];
n10 -> n12;
}

View File

@@ -0,0 +1,125 @@
digraph CFG {
node [fontname="Helvetica"];
n14 [label="START", shape=box];
n14 -> n65;
n65 [label="10", shape=box];
n65 -> n66;
n66 [label="CALL f1", shape=box, style=filled, color=orange];
n66 -> n16;
n16 [label="START f1(b)", shape=box, style=filled, color=green];
n16 -> n21;
n21 [label="b", shape=box];
n21 -> n22;
n22 [label="0", shape=box];
n22 -> n23;
n23 [label="b == 0", shape=box];
n23 -> n24;
n24 [label="<?>", shape=diamond];
n24 -> n28 [label="T"];
n28 [label="0", shape=box];
n28 -> n17;
n17 [label="END f1(b)", shape=box, style=filled, color=green];
n17 -> n34;
n34 [label="RET f1", shape=box, style=filled, color=orange];
n34 -> n17;
n17 -> n45;
n45 [label="RET f1", shape=box, style=filled, color=orange];
n45 -> n58;
n58 [label="a", shape=box];
n58 -> n59;
n59 [label="b", shape=box];
n59 -> n60;
n60 [label="a * b", shape=box];
n60 -> n61;
n61 [label="CALL g", shape=box, style=filled, color=orange];
n61 -> n50;
n50 [label="START g(c)", shape=box, style=filled, color=green];
n50 -> n53;
n53 [label="a", shape=box];
n53 -> n54;
n54 [label="b", shape=box];
n54 -> n55;
n55 [label="a * b", shape=box];
n55 -> n56;
n56 [label="c", shape=box];
n56 -> n57;
n57 [label="(a * b) * c", shape=box];
n57 -> n51;
n51 [label="END g(c)", shape=box, style=filled, color=green];
n51 -> n63;
n63 [label="RET g", shape=box, style=filled, color=orange];
n63 -> n19;
n19 [label="END f2(a, b)", shape=box, style=filled, color=green];
n19 -> n91;
n91 [label="RET f2", shape=box, style=filled, color=orange];
n61 -> n63;
n17 -> n49;
n49 [label="RET f1", shape=box, style=filled, color=orange];
n49 -> n58;
n17 -> n68;
n68 [label="RET f1", shape=box, style=filled, color=orange];
n68 -> n70;
n70 [label="10", shape=box];
n70 -> n83;
n83 [label="20", shape=box];
n83 -> n84;
n84 [label="30", shape=box];
n84 -> n85;
n85 [label="CALL max", shape=box, style=filled, color=orange];
n85 -> n71;
n71 [label="START max(a, b)", shape=box, style=filled, color=green];
n71 -> n74;
n74 [label="a", shape=box];
n74 -> n75;
n75 [label="b", shape=box];
n75 -> n76;
n76 [label="a > b", shape=box];
n76 -> n77;
n77 [label="<?>", shape=diamond];
n77 -> n81 [label="T"];
n81 [label="a", shape=box];
n81 -> n72;
n72 [label="END max(a, b)", shape=box, style=filled, color=green];
n72 -> n87;
n87 [label="RET max", shape=box, style=filled, color=orange];
n87 -> n89;
n89 [label="CALL f2", shape=box, style=filled, color=orange];
n89 -> n18;
n18 [label="START f2(a, b)", shape=box, style=filled, color=green];
n18 -> n35;
n35 [label="a", shape=box];
n35 -> n36;
n36 [label="b", shape=box];
n36 -> n37;
n37 [label="a > b", shape=box];
n37 -> n38;
n38 [label="<?>", shape=diamond];
n38 -> n42 [label="T"];
n42 [label="a", shape=box];
n42 -> n43;
n43 [label="CALL f1", shape=box, style=filled, color=orange];
n43 -> n16;
n43 -> n45;
n38 -> n46 [label="F"];
n46 [label="b", shape=box];
n46 -> n47;
n47 [label="CALL f1", shape=box, style=filled, color=orange];
n47 -> n16;
n47 -> n49;
n89 -> n91;
n77 -> n82 [label="F"];
n82 [label="b", shape=box];
n82 -> n72;
n85 -> n87;
n24 -> n29 [label="F"];
n29 [label="b", shape=box];
n29 -> n30;
n30 [label="1", shape=box];
n30 -> n31;
n31 [label="b - 1", shape=box];
n31 -> n32;
n32 [label="CALL f1", shape=box, style=filled, color=orange];
n32 -> n16;
n32 -> n34;
n66 -> n68;
}

View File

@@ -0,0 +1,24 @@
digraph CFG {
node [fontname="Helvetica"];
n92 [label="START", shape=box];
n92 -> n94;
n94 [label="2", shape=box];
n94 -> n95;
n95 [label="x", shape=box];
n95 -> n96;
n96 [label="2 < x", shape=box];
n96 -> n97;
n97 [label="x", shape=box];
n97 -> n98;
n98 [label="9", shape=box];
n98 -> n99;
n99 [label="x > 9", shape=box];
n99 -> n100;
n100 [label="(2 < x) && (x > 9)", shape=box];
n100 -> n101;
n101 [label="<?>", shape=diamond];
n101 -> n105 [label="T"];
n105 [label="1", shape=box];
n101 -> n106 [label="F"];
n106 [label="0", shape=box];
}

View File

@@ -0,0 +1,43 @@
digraph CFG {
node [fontname="Helvetica"];
n107 [label="START", shape=box];
n107 -> n119;
n119 [label="1", shape=box];
n119 -> n120;
n120 [label="CALL a", shape=box, style=filled, color=orange];
n120 -> n109;
n109 [label="START a(x)", shape=box, style=filled, color=green];
n109 -> n116;
n116 [label="x", shape=box];
n116 -> n110;
n110 [label="END a(x)", shape=box, style=filled, color=green];
n110 -> n122;
n122 [label="RET a", shape=box, style=filled, color=orange];
n122 -> n124;
n124 [label="2", shape=box];
n124 -> n125;
n125 [label="CALL b", shape=box, style=filled, color=orange];
n125 -> n111;
n111 [label="START b(y)", shape=box, style=filled, color=green];
n111 -> n117;
n117 [label="y", shape=box];
n117 -> n112;
n112 [label="END b(y)", shape=box, style=filled, color=green];
n112 -> n127;
n127 [label="RET b", shape=box, style=filled, color=orange];
n127 -> n128;
n128 [label="3", shape=box];
n128 -> n129;
n129 [label="CALL c", shape=box, style=filled, color=orange];
n129 -> n113;
n113 [label="START c(z)", shape=box, style=filled, color=green];
n113 -> n118;
n118 [label="z", shape=box];
n118 -> n114;
n114 [label="END c(z)", shape=box, style=filled, color=green];
n114 -> n131;
n131 [label="RET c", shape=box, style=filled, color=orange];
n129 -> n131;
n125 -> n127;
n120 -> n122;
}

View File

@@ -0,0 +1,67 @@
digraph CFG {
node [fontname="Helvetica"];
n132 [label="START", shape=box];
n132 -> n167;
n167 [label="2", shape=box];
n167 -> n168;
n168 [label="3", shape=box];
n168 -> n169;
n169 [label="CALL f", shape=box, style=filled, color=orange];
n169 -> n134;
n134 [label="START f(x, y, z)", shape=box, style=filled, color=green];
n134 -> n137;
n137 [label="2", shape=box];
n137 -> n138;
n138 [label="y = 2", shape=box];
n138 -> n139;
n139 [label="3", shape=box];
n139 -> n140;
n140 [label="z = 3", shape=box];
n140 -> n160;
n160 [label="x", shape=box];
n160 -> n161;
n161 [label="CALL g", shape=box, style=filled, color=orange];
n161 -> n141;
n141 [label="START g(x)", shape=box, style=filled, color=green];
n141 -> n144;
n144 [label="7", shape=box];
n144 -> n145;
n145 [label="x = 7", shape=box];
n145 -> n146;
n146 [label="y", shape=box];
n146 -> n147;
n147 [label="0", shape=box];
n147 -> n148;
n148 [label="y > 0", shape=box];
n148 -> n149;
n149 [label="<?>", shape=diamond];
n149 -> n153 [label="T"];
n153 [label="y", shape=box];
n153 -> n154;
n154 [label="CALL g", shape=box, style=filled, color=orange];
n154 -> n141;
n154 -> n156;
n156 [label="RET g", shape=box, style=filled, color=orange];
n156 -> n159;
n159 [label="x", shape=box];
n159 -> n142;
n142 [label="END g(x)", shape=box, style=filled, color=green];
n142 -> n156;
n142 -> n163;
n163 [label="RET g", shape=box, style=filled, color=orange];
n163 -> n164;
n164 [label="x", shape=box];
n164 -> n165;
n165 [label="g(x) + x", shape=box];
n165 -> n135;
n135 [label="END f(x, y, z)", shape=box, style=filled, color=green];
n135 -> n171;
n171 [label="RET f", shape=box, style=filled, color=orange];
n149 -> n157 [label="F"];
n157 [label="8", shape=box];
n157 -> n158;
n158 [label="x = 8", shape=box];
n158 -> n159;
n161 -> n163;
n169 -> n171;
}

View File

@@ -0,0 +1,266 @@
digraph CFG {
node [fontname="Helvetica"];
n173 [label="START", shape=box];
n173 -> n338;
n338 [label="3", shape=box];
n338 -> n339;
n339 [label="CALL fac", shape=box, style=filled, color=orange];
n339 -> n191;
n191 [label="START fac(x)", shape=box, style=filled, color=green];
n191 -> n194;
n194 [label="x", shape=box];
n194 -> n195;
n195 [label="1", shape=box];
n195 -> n196;
n196 [label="x == 1", shape=box];
n196 -> n197;
n197 [label="<?>", shape=diamond];
n197 -> n201 [label="T"];
n201 [label="1", shape=box];
n201 -> n192;
n192 [label="END fac(x)", shape=box, style=filled, color=green];
n192 -> n207;
n207 [label="RET fac", shape=box, style=filled, color=orange];
n207 -> n208;
n208 [label="x", shape=box];
n208 -> n209;
n209 [label="fac((x - 1)) * x", shape=box];
n209 -> n192;
n192 -> n223;
n223 [label="RET fac", shape=box, style=filled, color=orange];
n223 -> n224;
n224 [label="x", shape=box];
n224 -> n225;
n225 [label="fac((x - 1)) * x", shape=box];
n225 -> n192;
n192 -> n239;
n239 [label="RET fac", shape=box, style=filled, color=orange];
n239 -> n240;
n240 [label="x", shape=box];
n240 -> n241;
n241 [label="fac((x - 1)) * x", shape=box];
n241 -> n192;
n192 -> n255;
n255 [label="RET fac", shape=box, style=filled, color=orange];
n255 -> n256;
n256 [label="x", shape=box];
n256 -> n257;
n257 [label="fac((x - 1)) * x", shape=box];
n257 -> n192;
n192 -> n271;
n271 [label="RET fac", shape=box, style=filled, color=orange];
n271 -> n272;
n272 [label="x", shape=box];
n272 -> n273;
n273 [label="fac((x - 1)) * x", shape=box];
n273 -> n192;
n192 -> n287;
n287 [label="RET fac", shape=box, style=filled, color=orange];
n287 -> n288;
n288 [label="x", shape=box];
n288 -> n289;
n289 [label="fac((x - 1)) * x", shape=box];
n289 -> n192;
n192 -> n303;
n303 [label="RET fac", shape=box, style=filled, color=orange];
n303 -> n304;
n304 [label="x", shape=box];
n304 -> n305;
n305 [label="fac((x - 1)) * x", shape=box];
n305 -> n192;
n192 -> n319;
n319 [label="RET fac", shape=box, style=filled, color=orange];
n319 -> n320;
n320 [label="x", shape=box];
n320 -> n321;
n321 [label="fac((x - 1)) * x", shape=box];
n321 -> n192;
n192 -> n335;
n335 [label="RET fac", shape=box, style=filled, color=orange];
n335 -> n336;
n336 [label="x", shape=box];
n336 -> n337;
n337 [label="fac((x - 1)) * x", shape=box];
n337 -> n192;
n192 -> n341;
n341 [label="RET fac", shape=box, style=filled, color=orange];
n197 -> n202 [label="F"];
n202 [label="x", shape=box];
n202 -> n203;
n203 [label="1", shape=box];
n203 -> n204;
n204 [label="x - 1", shape=box];
n204 -> n205;
n205 [label="CALL fac", shape=box, style=filled, color=orange];
n205 -> n191;
n205 -> n207;
n191 -> n210;
n210 [label="x", shape=box];
n210 -> n211;
n211 [label="1", shape=box];
n211 -> n212;
n212 [label="x == 1", shape=box];
n212 -> n213;
n213 [label="<?>", shape=diamond];
n213 -> n217 [label="T"];
n217 [label="1", shape=box];
n217 -> n192;
n213 -> n218 [label="F"];
n218 [label="x", shape=box];
n218 -> n219;
n219 [label="1", shape=box];
n219 -> n220;
n220 [label="x - 1", shape=box];
n220 -> n221;
n221 [label="CALL fac", shape=box, style=filled, color=orange];
n221 -> n191;
n221 -> n223;
n191 -> n226;
n226 [label="x", shape=box];
n226 -> n227;
n227 [label="1", shape=box];
n227 -> n228;
n228 [label="x == 1", shape=box];
n228 -> n229;
n229 [label="<?>", shape=diamond];
n229 -> n233 [label="T"];
n233 [label="1", shape=box];
n233 -> n192;
n229 -> n234 [label="F"];
n234 [label="x", shape=box];
n234 -> n235;
n235 [label="1", shape=box];
n235 -> n236;
n236 [label="x - 1", shape=box];
n236 -> n237;
n237 [label="CALL fac", shape=box, style=filled, color=orange];
n237 -> n191;
n237 -> n239;
n191 -> n242;
n242 [label="x", shape=box];
n242 -> n243;
n243 [label="1", shape=box];
n243 -> n244;
n244 [label="x == 1", shape=box];
n244 -> n245;
n245 [label="<?>", shape=diamond];
n245 -> n249 [label="T"];
n249 [label="1", shape=box];
n249 -> n192;
n245 -> n250 [label="F"];
n250 [label="x", shape=box];
n250 -> n251;
n251 [label="1", shape=box];
n251 -> n252;
n252 [label="x - 1", shape=box];
n252 -> n253;
n253 [label="CALL fac", shape=box, style=filled, color=orange];
n253 -> n191;
n253 -> n255;
n191 -> n258;
n258 [label="x", shape=box];
n258 -> n259;
n259 [label="1", shape=box];
n259 -> n260;
n260 [label="x == 1", shape=box];
n260 -> n261;
n261 [label="<?>", shape=diamond];
n261 -> n265 [label="T"];
n265 [label="1", shape=box];
n265 -> n192;
n261 -> n266 [label="F"];
n266 [label="x", shape=box];
n266 -> n267;
n267 [label="1", shape=box];
n267 -> n268;
n268 [label="x - 1", shape=box];
n268 -> n269;
n269 [label="CALL fac", shape=box, style=filled, color=orange];
n269 -> n191;
n269 -> n271;
n191 -> n274;
n274 [label="x", shape=box];
n274 -> n275;
n275 [label="1", shape=box];
n275 -> n276;
n276 [label="x == 1", shape=box];
n276 -> n277;
n277 [label="<?>", shape=diamond];
n277 -> n281 [label="T"];
n281 [label="1", shape=box];
n281 -> n192;
n277 -> n282 [label="F"];
n282 [label="x", shape=box];
n282 -> n283;
n283 [label="1", shape=box];
n283 -> n284;
n284 [label="x - 1", shape=box];
n284 -> n285;
n285 [label="CALL fac", shape=box, style=filled, color=orange];
n285 -> n191;
n285 -> n287;
n191 -> n290;
n290 [label="x", shape=box];
n290 -> n291;
n291 [label="1", shape=box];
n291 -> n292;
n292 [label="x == 1", shape=box];
n292 -> n293;
n293 [label="<?>", shape=diamond];
n293 -> n297 [label="T"];
n297 [label="1", shape=box];
n297 -> n192;
n293 -> n298 [label="F"];
n298 [label="x", shape=box];
n298 -> n299;
n299 [label="1", shape=box];
n299 -> n300;
n300 [label="x - 1", shape=box];
n300 -> n301;
n301 [label="CALL fac", shape=box, style=filled, color=orange];
n301 -> n191;
n301 -> n303;
n191 -> n306;
n306 [label="x", shape=box];
n306 -> n307;
n307 [label="1", shape=box];
n307 -> n308;
n308 [label="x == 1", shape=box];
n308 -> n309;
n309 [label="<?>", shape=diamond];
n309 -> n313 [label="T"];
n313 [label="1", shape=box];
n313 -> n192;
n309 -> n314 [label="F"];
n314 [label="x", shape=box];
n314 -> n315;
n315 [label="1", shape=box];
n315 -> n316;
n316 [label="x - 1", shape=box];
n316 -> n317;
n317 [label="CALL fac", shape=box, style=filled, color=orange];
n317 -> n191;
n317 -> n319;
n191 -> n322;
n322 [label="x", shape=box];
n322 -> n323;
n323 [label="1", shape=box];
n323 -> n324;
n324 [label="x == 1", shape=box];
n324 -> n325;
n325 [label="<?>", shape=diamond];
n325 -> n329 [label="T"];
n329 [label="1", shape=box];
n329 -> n192;
n325 -> n330 [label="F"];
n330 [label="x", shape=box];
n330 -> n331;
n331 [label="1", shape=box];
n331 -> n332;
n332 [label="x - 1", shape=box];
n332 -> n333;
n333 [label="CALL fac", shape=box, style=filled, color=orange];
n333 -> n191;
n333 -> n335;
n339 -> n341;
}

View File

@@ -0,0 +1,6 @@
digraph CFG {
node [fontname="Helvetica"];
n356 [label="START", shape=box];
n356 -> n358;
n358 [label="0", shape=box];
}

View File

@@ -0,0 +1,50 @@
digraph CFG {
node [fontname="Helvetica"];
n359 [label="START", shape=box];
n359 -> n382;
n382 [label="10", shape=box];
n382 -> n383;
n383 [label="8", shape=box];
n383 -> n384;
n384 [label="CALL func", shape=box, style=filled, color=orange];
n384 -> n361;
n361 [label="START func(a, b)", shape=box, style=filled, color=green];
n361 -> n364;
n364 [label="a", shape=box];
n364 -> n365;
n365 [label="0", shape=box];
n365 -> n366;
n366 [label="a > 0", shape=box];
n366 -> n367;
n367 [label="b", shape=box];
n367 -> n368;
n368 [label="a", shape=box];
n368 -> n369;
n369 [label="b != a", shape=box];
n369 -> n370;
n370 [label="(a > 0) && (b != a)", shape=box];
n370 -> n371;
n371 [label="<?>", shape=diamond];
n371 -> n362 [label="T"];
n362 [label="END func(a, b)", shape=box, style=filled, color=green];
n362 -> n386;
n386 [label="RET func", shape=box, style=filled, color=orange];
n371 -> n373 [label="F"];
n373 [label="b", shape=box];
n373 -> n374;
n374 [label="1", shape=box];
n374 -> n375;
n375 [label="b + 1", shape=box];
n375 -> n376;
n376 [label="b = (b + 1)", shape=box];
n376 -> n377;
n377 [label="a", shape=box];
n377 -> n378;
n378 [label="1", shape=box];
n378 -> n379;
n379 [label="a - 1", shape=box];
n379 -> n380;
n380 [label="a = (a - 1)", shape=box];
n380 -> n366;
n384 -> n386;
}

View File

@@ -0,0 +1,16 @@
digraph CFG {
node [fontname="Helvetica"];
n388 [label="START", shape=box];
n388 -> n390;
n390 [label="1", shape=box];
n390 -> n391;
n391 [label="0", shape=box];
n391 -> n392;
n392 [label="1 >= 0", shape=box];
n392 -> n393;
n393 [label="<?>", shape=diamond];
n393 -> n397 [label="T"];
n397 [label="1", shape=box];
n393 -> n398 [label="F"];
n398 [label="0", shape=box];
}

View File

@@ -0,0 +1,65 @@
digraph CFG {
node [fontname="Helvetica"];
n405 [label="START", shape=box];
n405 -> n439;
n439 [label="3528", shape=box];
n439 -> n440;
n440 [label="3780", shape=box];
n440 -> n441;
n441 [label="CALL ggT", shape=box, style=filled, color=orange];
n441 -> n407;
n407 [label="START ggT(a, b)", shape=box, style=filled, color=green];
n407 -> n410;
n410 [label="a", shape=box];
n410 -> n411;
n411 [label="b", shape=box];
n411 -> n412;
n412 [label="a == b", shape=box];
n412 -> n413;
n413 [label="<?>", shape=diamond];
n413 -> n417 [label="T"];
n417 [label="a", shape=box];
n417 -> n408;
n408 [label="END ggT(a, b)", shape=box, style=filled, color=green];
n408 -> n431;
n431 [label="RET ggT", shape=box, style=filled, color=orange];
n431 -> n408;
n408 -> n438;
n438 [label="RET ggT", shape=box, style=filled, color=orange];
n438 -> n408;
n408 -> n443;
n443 [label="RET ggT", shape=box, style=filled, color=orange];
n413 -> n418 [label="F"];
n418 [label="a", shape=box];
n418 -> n419;
n419 [label="b", shape=box];
n419 -> n420;
n420 [label="a > b", shape=box];
n420 -> n421;
n421 [label="<?>", shape=diamond];
n421 -> n425 [label="T"];
n425 [label="a", shape=box];
n425 -> n426;
n426 [label="b", shape=box];
n426 -> n427;
n427 [label="a - b", shape=box];
n427 -> n428;
n428 [label="b", shape=box];
n428 -> n429;
n429 [label="CALL ggT", shape=box, style=filled, color=orange];
n429 -> n407;
n429 -> n431;
n421 -> n432 [label="F"];
n432 [label="b", shape=box];
n432 -> n433;
n433 [label="a", shape=box];
n433 -> n434;
n434 [label="b - a", shape=box];
n434 -> n435;
n435 [label="a", shape=box];
n435 -> n436;
n436 [label="CALL ggT", shape=box, style=filled, color=orange];
n436 -> n407;
n436 -> n438;
n441 -> n443;
}

View File

@@ -0,0 +1,109 @@
digraph CFG {
node [fontname="Helvetica"];
n445 [label="START", shape=box];
n445 -> n499;
n499 [label="1", shape=box];
n499 -> n500;
n500 [label="2", shape=box];
n500 -> n501;
n501 [label="CALL f", shape=box, style=filled, color=orange];
n501 -> n447;
n447 [label="START f(x, y)", shape=box, style=filled, color=green];
n447 -> n452;
n452 [label="x", shape=box];
n452 -> n453;
n453 [label="0", shape=box];
n453 -> n454;
n454 [label="x == 0", shape=box];
n454 -> n455;
n455 [label="<?>", shape=diamond];
n455 -> n467 [label="T"];
n467 [label="2", shape=box];
n467 -> n468;
n468 [label="y", shape=box];
n468 -> n469;
n469 [label="2 * y", shape=box];
n469 -> n470;
n470 [label="x", shape=box];
n470 -> n471;
n471 [label="CALL g", shape=box, style=filled, color=orange];
n471 -> n459;
n459 [label="START g(x, z)", shape=box, style=filled, color=green];
n459 -> n462;
n462 [label="x", shape=box];
n462 -> n463;
n463 [label="y", shape=box];
n463 -> n464;
n464 [label="x * y", shape=box];
n464 -> n465;
n465 [label="z", shape=box];
n465 -> n466;
n466 [label="(x * y) + z", shape=box];
n466 -> n460;
n460 [label="END g(x, z)", shape=box, style=filled, color=green];
n460 -> n473;
n473 [label="RET g", shape=box, style=filled, color=orange];
n473 -> n448;
n448 [label="END f(x, y)", shape=box, style=filled, color=green];
n448 -> n488;
n488 [label="RET f", shape=box, style=filled, color=orange];
n488 -> n489;
n489 [label="a * f(a,i)", shape=box];
n489 -> n490;
n490 [label="a = (a * f(a,i))", shape=box];
n490 -> n491;
n491 [label="i", shape=box];
n491 -> n492;
n492 [label="1", shape=box];
n492 -> n493;
n493 [label="i - 1", shape=box];
n493 -> n494;
n494 [label="i = (i - 1)", shape=box];
n494 -> n478;
n478 [label="i", shape=box];
n478 -> n479;
n479 [label="0", shape=box];
n479 -> n480;
n480 [label="i > 0", shape=box];
n480 -> n481;
n481 [label="<?>", shape=diamond];
n481 -> n483 [label="T"];
n483 [label="a", shape=box];
n483 -> n484;
n484 [label="a", shape=box];
n484 -> n485;
n485 [label="i", shape=box];
n485 -> n486;
n486 [label="CALL f", shape=box, style=filled, color=orange];
n486 -> n447;
n486 -> n488;
n481 -> n496 [label="F"];
n496 [label="a", shape=box];
n496 -> n497;
n497 [label="42", shape=box];
n497 -> n498;
n498 [label="a + 42", shape=box];
n498 -> n460;
n448 -> n503;
n503 [label="RET f", shape=box, style=filled, color=orange];
n503 -> n505;
n505 [label="3", shape=box];
n505 -> n506;
n506 [label="3", shape=box];
n506 -> n507;
n507 [label="CALL g", shape=box, style=filled, color=orange];
n507 -> n459;
n507 -> n509;
n509 [label="RET g", shape=box, style=filled, color=orange];
n460 -> n509;
n459 -> n478;
n471 -> n473;
n455 -> n475 [label="F"];
n475 [label="x", shape=box];
n475 -> n476;
n476 [label="1", shape=box];
n476 -> n477;
n477 [label="x + 1", shape=box];
n477 -> n448;
n501 -> n503;
}

View File

@@ -0,0 +1,34 @@
digraph CFG {
node [fontname="Helvetica"];
n512 [label="START", shape=box];
n512 -> n518;
n518 [label="5", shape=box];
n518 -> n519;
n519 [label="CALL m", shape=box, style=filled, color=orange];
n519 -> n514;
n514 [label="START m(a)", shape=box, style=filled, color=green];
n514 -> n517;
n517 [label="a", shape=box];
n517 -> n515;
n515 [label="END m(a)", shape=box, style=filled, color=green];
n515 -> n521;
n521 [label="RET m", shape=box, style=filled, color=orange];
n521 -> n529;
n529 [label="5", shape=box];
n529 -> n530;
n530 [label="CALL m", shape=box, style=filled, color=orange];
n530 -> n523;
n523 [label="START m(b)", shape=box, style=filled, color=green];
n523 -> n526;
n526 [label="b", shape=box];
n526 -> n527;
n527 [label="1", shape=box];
n527 -> n528;
n528 [label="b + 1", shape=box];
n528 -> n524;
n524 [label="END m(b)", shape=box, style=filled, color=green];
n524 -> n532;
n532 [label="RET m", shape=box, style=filled, color=orange];
n530 -> n532;
n519 -> n521;
}

View File

@@ -0,0 +1,44 @@
digraph CFG {
node [fontname="Helvetica"];
n534 [label="START", shape=box];
n534 -> n540;
n540 [label="5", shape=box];
n540 -> n541;
n541 [label="CALL n", shape=box, style=filled, color=orange];
n541 -> n536;
n536 [label="START n(a)", shape=box, style=filled, color=green];
n536 -> n539;
n539 [label="a", shape=box];
n539 -> n537;
n537 [label="END n(a)", shape=box, style=filled, color=green];
n537 -> n543;
n543 [label="RET n", shape=box, style=filled, color=orange];
n543 -> n551;
n551 [label="5", shape=box];
n551 -> n552;
n552 [label="CALL n", shape=box, style=filled, color=orange];
n552 -> n536;
n552 -> n554;
n554 [label="RET n", shape=box, style=filled, color=orange];
n554 -> n555;
n555 [label="5", shape=box];
n555 -> n556;
n556 [label="CALL m", shape=box, style=filled, color=orange];
n556 -> n545;
n545 [label="START m(a)", shape=box, style=filled, color=green];
n545 -> n548;
n548 [label="a", shape=box];
n548 -> n549;
n549 [label="1", shape=box];
n549 -> n550;
n550 [label="a + 1", shape=box];
n550 -> n546;
n546 [label="END m(a)", shape=box, style=filled, color=green];
n546 -> n558;
n558 [label="RET m", shape=box, style=filled, color=orange];
n558 -> n559;
n559 [label="n(5) + m(5)", shape=box];
n556 -> n558;
n537 -> n554;
n541 -> n543;
}

View File

@@ -0,0 +1,20 @@
digraph CFG {
node [fontname="Helvetica"];
n561 [label="START", shape=box];
n561 -> n563;
n563 [label="True", shape=box];
n563 -> n564;
n564 [label="True", shape=box];
n564 -> n565;
n565 [label="True", shape=box];
n565 -> n566;
n566 [label="True == True", shape=box];
n566 -> n567;
n567 [label="True || (True == True)", shape=box];
n567 -> n568;
n568 [label="<?>", shape=diamond];
n568 -> n572 [label="T"];
n572 [label="1", shape=box];
n568 -> n573 [label="F"];
n573 [label="0", shape=box];
}

View File

@@ -0,0 +1,21 @@
digraph CFG {
node [fontname="Helvetica"];
n574 [label="START", shape=box];
n574 -> n582;
n582 [label="5", shape=box];
n582 -> n583;
n583 [label="CALL g", shape=box, style=filled, color=orange];
n583 -> n576;
n576 [label="START g(a)", shape=box, style=filled, color=green];
n576 -> n579;
n579 [label="a", shape=box];
n579 -> n580;
n580 [label="a", shape=box];
n580 -> n581;
n581 [label="a * a", shape=box];
n581 -> n577;
n577 [label="END g(a)", shape=box, style=filled, color=green];
n577 -> n585;
n585 [label="RET g", shape=box, style=filled, color=orange];
n583 -> n585;
}

View File

@@ -0,0 +1,38 @@
digraph CFG {
node [fontname="Helvetica"];
n587 [label="START", shape=box];
n587 -> n606;
n606 [label="10", shape=box];
n606 -> n607;
n607 [label="CALL f1", shape=box, style=filled, color=orange];
n607 -> n589;
n589 [label="START f1(b)", shape=box, style=filled, color=green];
n589 -> n592;
n592 [label="b", shape=box];
n592 -> n593;
n593 [label="0", shape=box];
n593 -> n594;
n594 [label="b == 0", shape=box];
n594 -> n595;
n595 [label="<?>", shape=diamond];
n595 -> n599 [label="T"];
n599 [label="0", shape=box];
n599 -> n590;
n590 [label="END f1(b)", shape=box, style=filled, color=green];
n590 -> n605;
n605 [label="RET f1", shape=box, style=filled, color=orange];
n605 -> n590;
n590 -> n609;
n609 [label="RET f1", shape=box, style=filled, color=orange];
n595 -> n600 [label="F"];
n600 [label="b", shape=box];
n600 -> n601;
n601 [label="1", shape=box];
n601 -> n602;
n602 [label="b - 1", shape=box];
n602 -> n603;
n603 [label="CALL f1", shape=box, style=filled, color=orange];
n603 -> n589;
n603 -> n605;
n607 -> n609;
}

View File

@@ -0,0 +1,125 @@
digraph CFG {
node [fontname="Helvetica"];
n611 [label="START", shape=box];
n611 -> n662;
n662 [label="10", shape=box];
n662 -> n663;
n663 [label="CALL f1", shape=box, style=filled, color=orange];
n663 -> n613;
n613 [label="START f1(b)", shape=box, style=filled, color=green];
n613 -> n618;
n618 [label="b", shape=box];
n618 -> n619;
n619 [label="0", shape=box];
n619 -> n620;
n620 [label="b == 0", shape=box];
n620 -> n621;
n621 [label="<?>", shape=diamond];
n621 -> n625 [label="T"];
n625 [label="0", shape=box];
n625 -> n614;
n614 [label="END f1(b)", shape=box, style=filled, color=green];
n614 -> n631;
n631 [label="RET f1", shape=box, style=filled, color=orange];
n631 -> n614;
n614 -> n642;
n642 [label="RET f1", shape=box, style=filled, color=orange];
n642 -> n655;
n655 [label="a", shape=box];
n655 -> n656;
n656 [label="b", shape=box];
n656 -> n657;
n657 [label="a * b", shape=box];
n657 -> n658;
n658 [label="CALL g", shape=box, style=filled, color=orange];
n658 -> n647;
n647 [label="START g(c)", shape=box, style=filled, color=green];
n647 -> n650;
n650 [label="a", shape=box];
n650 -> n651;
n651 [label="b", shape=box];
n651 -> n652;
n652 [label="a * b", shape=box];
n652 -> n653;
n653 [label="c", shape=box];
n653 -> n654;
n654 [label="(a * b) * c", shape=box];
n654 -> n648;
n648 [label="END g(c)", shape=box, style=filled, color=green];
n648 -> n660;
n660 [label="RET g", shape=box, style=filled, color=orange];
n660 -> n616;
n616 [label="END f2(a, b)", shape=box, style=filled, color=green];
n616 -> n688;
n688 [label="RET f2", shape=box, style=filled, color=orange];
n658 -> n660;
n614 -> n646;
n646 [label="RET f1", shape=box, style=filled, color=orange];
n646 -> n655;
n614 -> n665;
n665 [label="RET f1", shape=box, style=filled, color=orange];
n665 -> n667;
n667 [label="10", shape=box];
n667 -> n680;
n680 [label="20", shape=box];
n680 -> n681;
n681 [label="30", shape=box];
n681 -> n682;
n682 [label="CALL max", shape=box, style=filled, color=orange];
n682 -> n668;
n668 [label="START max(a, b)", shape=box, style=filled, color=green];
n668 -> n671;
n671 [label="a", shape=box];
n671 -> n672;
n672 [label="b", shape=box];
n672 -> n673;
n673 [label="a > b", shape=box];
n673 -> n674;
n674 [label="<?>", shape=diamond];
n674 -> n678 [label="T"];
n678 [label="a", shape=box];
n678 -> n669;
n669 [label="END max(a, b)", shape=box, style=filled, color=green];
n669 -> n684;
n684 [label="RET max", shape=box, style=filled, color=orange];
n684 -> n686;
n686 [label="CALL f2", shape=box, style=filled, color=orange];
n686 -> n615;
n615 [label="START f2(a, b)", shape=box, style=filled, color=green];
n615 -> n632;
n632 [label="a", shape=box];
n632 -> n633;
n633 [label="b", shape=box];
n633 -> n634;
n634 [label="a > b", shape=box];
n634 -> n635;
n635 [label="<?>", shape=diamond];
n635 -> n639 [label="T"];
n639 [label="a", shape=box];
n639 -> n640;
n640 [label="CALL f1", shape=box, style=filled, color=orange];
n640 -> n613;
n640 -> n642;
n635 -> n643 [label="F"];
n643 [label="b", shape=box];
n643 -> n644;
n644 [label="CALL f1", shape=box, style=filled, color=orange];
n644 -> n613;
n644 -> n646;
n686 -> n688;
n674 -> n679 [label="F"];
n679 [label="b", shape=box];
n679 -> n669;
n682 -> n684;
n621 -> n626 [label="F"];
n626 [label="b", shape=box];
n626 -> n627;
n627 [label="1", shape=box];
n627 -> n628;
n628 [label="b - 1", shape=box];
n628 -> n629;
n629 [label="CALL f1", shape=box, style=filled, color=orange];
n629 -> n613;
n629 -> n631;
n663 -> n665;
}

View File

@@ -0,0 +1,25 @@
digraph CFG {
node [fontname="Helvetica"];
n689 [label="START", shape=box];
n689 -> n698;
n698 [label="10", shape=box];
n698 -> n699;
n699 [label="8", shape=box];
n699 -> n700;
n700 [label="CALL func", shape=box, style=filled, color=orange];
n700 -> n691;
n691 [label="START func(a, b)", shape=box, style=filled, color=green];
n691 -> n694;
n694 [label="b", shape=box];
n694 -> n695;
n695 [label="1", shape=box];
n695 -> n696;
n696 [label="b + 1", shape=box];
n696 -> n697;
n697 [label="a = (b + 1)", shape=box];
n697 -> n692;
n692 [label="END func(a, b)", shape=box, style=filled, color=green];
n692 -> n702;
n702 [label="RET func", shape=box, style=filled, color=orange];
n700 -> n702;
}

View File

@@ -0,0 +1,103 @@
digraph CFG {
node [fontname="Helvetica"];
n710 [label="START", shape=box];
n710 -> n762;
n762 [label="2", shape=box];
n762 -> n763;
n763 [label="3", shape=box];
n763 -> n764;
n764 [label="CALL f", shape=box, style=filled, color=orange];
n764 -> n712;
n712 [label="START f(a, b)", shape=box, style=filled, color=green];
n712 -> n717;
n717 [label="a", shape=box];
n717 -> n718;
n718 [label="0", shape=box];
n718 -> n719;
n719 [label="a == 0", shape=box];
n719 -> n720;
n720 [label="<?>", shape=diamond];
n720 -> n724 [label="T"];
n724 [label="2", shape=box];
n724 -> n725;
n725 [label="b", shape=box];
n725 -> n726;
n726 [label="2 + b", shape=box];
n726 -> n713;
n713 [label="END f(a, b)", shape=box, style=filled, color=green];
n713 -> n760;
n760 [label="RET f", shape=box, style=filled, color=orange];
n760 -> n761;
n761 [label="c * f((c - 1),d)", shape=box];
n761 -> n728;
n728 [label="END g(a, c)", shape=box, style=filled, color=green];
n728 -> n740;
n740 [label="RET g", shape=box, style=filled, color=orange];
n740 -> n741;
n741 [label="2 + g(a,b)", shape=box];
n741 -> n713;
n728 -> n772;
n772 [label="RET g", shape=box, style=filled, color=orange];
n713 -> n766;
n766 [label="RET f", shape=box, style=filled, color=orange];
n766 -> n768;
n768 [label="3", shape=box];
n768 -> n769;
n769 [label="2", shape=box];
n769 -> n770;
n770 [label="CALL g", shape=box, style=filled, color=orange];
n770 -> n727;
n727 [label="START g(a, c)", shape=box, style=filled, color=green];
n727 -> n730;
n730 [label="a", shape=box];
n730 -> n731;
n731 [label="c", shape=box];
n731 -> n732;
n732 [label="a + c", shape=box];
n732 -> n733;
n733 [label="b", shape=box];
n733 -> n734;
n734 [label="(a + c) + b", shape=box];
n734 -> n728;
n727 -> n743;
n743 [label="c", shape=box];
n743 -> n744;
n744 [label="0", shape=box];
n744 -> n745;
n745 [label="c == 0", shape=box];
n745 -> n746;
n746 [label="<?>", shape=diamond];
n746 -> n750 [label="T"];
n750 [label="1", shape=box];
n750 -> n751;
n751 [label="d", shape=box];
n751 -> n752;
n752 [label="1 + d", shape=box];
n752 -> n728;
n746 -> n753 [label="F"];
n753 [label="c", shape=box];
n753 -> n754;
n754 [label="c", shape=box];
n754 -> n755;
n755 [label="1", shape=box];
n755 -> n756;
n756 [label="c - 1", shape=box];
n756 -> n757;
n757 [label="d", shape=box];
n757 -> n758;
n758 [label="CALL f", shape=box, style=filled, color=orange];
n758 -> n712;
n758 -> n760;
n770 -> n772;
n720 -> n735 [label="F"];
n735 [label="2", shape=box];
n735 -> n736;
n736 [label="a", shape=box];
n736 -> n737;
n737 [label="b", shape=box];
n737 -> n738;
n738 [label="CALL g", shape=box, style=filled, color=orange];
n738 -> n727;
n738 -> n740;
n764 -> n766;
}

View File

@@ -0,0 +1,40 @@
digraph CFG {
node [fontname="Helvetica"];
n773 [label="START", shape=box];
n773 -> n792;
n792 [label="1", shape=box];
n792 -> n793;
n793 [label="2", shape=box];
n793 -> n794;
n794 [label="CALL f", shape=box, style=filled, color=orange];
n794 -> n775;
n775 [label="START f(x, y)", shape=box, style=filled, color=green];
n775 -> n785;
n785 [label="5", shape=box];
n785 -> n786;
n786 [label="CALL g", shape=box, style=filled, color=orange];
n786 -> n778;
n778 [label="START g(x)", shape=box, style=filled, color=green];
n778 -> n781;
n781 [label="x", shape=box];
n781 -> n782;
n782 [label="7", shape=box];
n782 -> n783;
n783 [label="x + 7", shape=box];
n783 -> n784;
n784 [label="y = (x + 7)", shape=box];
n784 -> n779;
n779 [label="END g(x)", shape=box, style=filled, color=green];
n779 -> n788;
n788 [label="RET g", shape=box, style=filled, color=orange];
n788 -> n789;
n789 [label="x = g(5)", shape=box];
n789 -> n791;
n791 [label="y", shape=box];
n791 -> n776;
n776 [label="END f(x, y)", shape=box, style=filled, color=green];
n776 -> n796;
n796 [label="RET f", shape=box, style=filled, color=orange];
n786 -> n788;
n794 -> n796;
}

View File

@@ -0,0 +1,59 @@
digraph CFG {
node [fontname="Helvetica"];
n798 [label="START", shape=box];
n798 -> n829;
n829 [label="3", shape=box];
n829 -> n830;
n830 [label="CALL f", shape=box, style=filled, color=orange];
n830 -> n800;
n800 [label="START f(x)", shape=box, style=filled, color=green];
n800 -> n803;
n803 [label="2", shape=box];
n803 -> n804;
n804 [label="x", shape=box];
n804 -> n805;
n805 [label="2 * x", shape=box];
n805 -> n806;
n806 [label="x = (2 * x)", shape=box];
n806 -> n807;
n807 [label="x", shape=box];
n807 -> n808;
n808 [label="0", shape=box];
n808 -> n809;
n809 [label="x > 0", shape=box];
n809 -> n810;
n810 [label="<?>", shape=diamond];
n810 -> n814 [label="T"];
n814 [label="x", shape=box];
n814 -> n815;
n815 [label="1", shape=box];
n815 -> n816;
n816 [label="x - 1", shape=box];
n816 -> n817;
n817 [label="x = (x - 1)", shape=box];
n817 -> n819;
n819 [label="x", shape=box];
n819 -> n820;
n820 [label="0", shape=box];
n820 -> n821;
n821 [label="x > 0", shape=box];
n821 -> n822;
n822 [label="<?>", shape=diamond];
n822 -> n801 [label="T"];
n801 [label="END f(x)", shape=box, style=filled, color=green];
n801 -> n832;
n832 [label="RET f", shape=box, style=filled, color=orange];
n822 -> n824 [label="F"];
n824 [label="x", shape=box];
n824 -> n825;
n825 [label="1", shape=box];
n825 -> n826;
n826 [label="x - 1", shape=box];
n826 -> n827;
n827 [label="x = (x - 1)", shape=box];
n827 -> n819;
n810 -> n818 [label="F"];
n818 [label="x", shape=box];
n818 -> n819;
n830 -> n832;
}

View File

@@ -0,0 +1,21 @@
digraph CFG {
node [fontname="Helvetica"];
n834 [label="START", shape=box];
n834 -> n842;
n842 [label="2", shape=box];
n842 -> n843;
n843 [label="CALL g", shape=box, style=filled, color=orange];
n843 -> n836;
n836 [label="START g(x, y)", shape=box, style=filled, color=green];
n836 -> n839;
n839 [label="3", shape=box];
n839 -> n840;
n840 [label="y = 3", shape=box];
n840 -> n841;
n841 [label="x", shape=box];
n841 -> n837;
n837 [label="END g(x, y)", shape=box, style=filled, color=green];
n837 -> n845;
n845 [label="RET g", shape=box, style=filled, color=orange];
n843 -> n845;
}

View File

@@ -0,0 +1,16 @@
digraph CFG {
node [fontname="Helvetica"];
n856 [label="START", shape=box];
n856 -> n858;
n858 [label="True", shape=box];
n858 -> n859;
n859 [label="False", shape=box];
n859 -> n860;
n860 [label="True && False", shape=box];
n860 -> n861;
n861 [label="<?>", shape=diamond];
n861 -> n865 [label="T"];
n865 [label="1", shape=box];
n861 -> n866 [label="F"];
n866 [label="0", shape=box];
}

View File

@@ -0,0 +1,16 @@
digraph CFG {
node [fontname="Helvetica"];
n867 [label="START", shape=box];
n867 -> n869;
n869 [label="True", shape=box];
n869 -> n870;
n870 [label="False", shape=box];
n870 -> n871;
n871 [label="True || False", shape=box];
n871 -> n872;
n872 [label="<?>", shape=diamond];
n872 -> n876 [label="T"];
n876 [label="1", shape=box];
n872 -> n877 [label="F"];
n877 [label="0", shape=box];
}

View File

@@ -0,0 +1,16 @@
digraph CFG {
node [fontname="Helvetica"];
n878 [label="START", shape=box];
n878 -> n880;
n880 [label="1", shape=box];
n880 -> n881;
n881 [label="2", shape=box];
n881 -> n882;
n882 [label="1 > 2", shape=box];
n882 -> n883;
n883 [label="<?>", shape=diamond];
n883 -> n887 [label="T"];
n887 [label="1", shape=box];
n883 -> n888 [label="F"];
n888 [label="0", shape=box];
}

View File

@@ -0,0 +1,20 @@
digraph CFG {
node [fontname="Helvetica"];
n889 [label="START", shape=box];
n889 -> n891;
n891 [label="2", shape=box];
n891 -> n892;
n892 [label="3", shape=box];
n892 -> n893;
n893 [label="5", shape=box];
n893 -> n894;
n894 [label="3 + 5", shape=box];
n894 -> n895;
n895 [label="2 > (3 + 5)", shape=box];
n895 -> n896;
n896 [label="<?>", shape=diamond];
n896 -> n900 [label="T"];
n900 [label="1", shape=box];
n896 -> n901 [label="F"];
n901 [label="0", shape=box];
}

View File

@@ -0,0 +1,24 @@
digraph CFG {
node [fontname="Helvetica"];
n902 [label="START", shape=box];
n902 -> n904;
n904 [label="1", shape=box];
n904 -> n905;
n905 [label="2", shape=box];
n905 -> n906;
n906 [label="1 > 2", shape=box];
n906 -> n907;
n907 [label="3", shape=box];
n907 -> n908;
n908 [label="5", shape=box];
n908 -> n909;
n909 [label="3 < 5", shape=box];
n909 -> n910;
n910 [label="(1 > 2) || (3 < 5)", shape=box];
n910 -> n911;
n911 [label="<?>", shape=diamond];
n911 -> n915 [label="T"];
n915 [label="1", shape=box];
n911 -> n916 [label="F"];
n916 [label="0", shape=box];
}

View File

@@ -0,0 +1,20 @@
digraph CFG {
node [fontname="Helvetica"];
n917 [label="START", shape=box];
n917 -> n919;
n919 [label="2", shape=box];
n919 -> n920;
n920 [label="0", shape=box];
n920 -> n921;
n921 [label="2 == 0", shape=box];
n921 -> n922;
n922 [label="False", shape=box];
n922 -> n923;
n923 [label="(2 == 0) == False", shape=box];
n923 -> n924;
n924 [label="<?>", shape=diamond];
n924 -> n928 [label="T"];
n928 [label="1", shape=box];
n924 -> n929 [label="F"];
n929 [label="0", shape=box];
}

View File

@@ -0,0 +1,12 @@
digraph CFG {
node [fontname="Helvetica"];
n847 [label="START", shape=box];
n847 -> n849;
n849 [label="True", shape=box];
n849 -> n850;
n850 [label="<?>", shape=diamond];
n850 -> n854 [label="T"];
n854 [label="1", shape=box];
n850 -> n855 [label="F"];
n855 [label="0", shape=box];
}

View File

@@ -0,0 +1,21 @@
digraph CFG {
node [fontname="Helvetica"];
n930 [label="START", shape=box];
n930 -> n938;
n938 [label="10", shape=box];
n938 -> n939;
n939 [label="CALL square", shape=box, style=filled, color=orange];
n939 -> n932;
n932 [label="START square(x)", shape=box, style=filled, color=green];
n932 -> n935;
n935 [label="x", shape=box];
n935 -> n936;
n936 [label="x", shape=box];
n936 -> n937;
n937 [label="x * x", shape=box];
n937 -> n933;
n933 [label="END square(x)", shape=box, style=filled, color=green];
n933 -> n941;
n941 [label="RET square", shape=box, style=filled, color=orange];
n939 -> n941;
}

View File

@@ -0,0 +1,92 @@
digraph CFG {
node [fontname="Helvetica"];
n943 [label="START", shape=box];
n943 -> n983;
n983 [label="2", shape=box];
n983 -> n984;
n984 [label="3", shape=box];
n984 -> n985;
n985 [label="CALL mult", shape=box, style=filled, color=orange];
n985 -> n945;
n945 [label="START mult(a, b)", shape=box, style=filled, color=green];
n945 -> n950;
n950 [label="a", shape=box];
n950 -> n951;
n951 [label="b", shape=box];
n951 -> n952;
n952 [label="a * b", shape=box];
n952 -> n946;
n946 [label="END mult(a, b)", shape=box, style=filled, color=green];
n946 -> n977;
n977 [label="RET mult", shape=box, style=filled, color=orange];
n977 -> n954;
n954 [label="END inc(a)", shape=box, style=filled, color=green];
n954 -> n972;
n972 [label="RET inc", shape=box, style=filled, color=orange];
n972 -> n954;
n954 -> n981;
n981 [label="RET inc", shape=box, style=filled, color=orange];
n981 -> n948;
n948 [label="END add(a, b)", shape=box, style=filled, color=green];
n948 -> n992;
n992 [label="RET add", shape=box, style=filled, color=orange];
n992 -> n993;
n993 [label="CALL add", shape=box, style=filled, color=orange];
n993 -> n947;
n947 [label="START add(a, b)", shape=box, style=filled, color=green];
n947 -> n978;
n978 [label="a", shape=box];
n978 -> n979;
n979 [label="CALL inc", shape=box, style=filled, color=orange];
n979 -> n953;
n953 [label="START inc(a)", shape=box, style=filled, color=green];
n953 -> n956;
n956 [label="b", shape=box];
n956 -> n957;
n957 [label="0", shape=box];
n957 -> n958;
n958 [label="b != 0", shape=box];
n958 -> n959;
n959 [label="<?>", shape=diamond];
n959 -> n963 [label="T"];
n963 [label="b", shape=box];
n963 -> n964;
n964 [label="1", shape=box];
n964 -> n965;
n965 [label="b - 1", shape=box];
n965 -> n966;
n966 [label="b = (b - 1)", shape=box];
n966 -> n967;
n967 [label="a", shape=box];
n967 -> n968;
n968 [label="1", shape=box];
n968 -> n969;
n969 [label="a + 1", shape=box];
n969 -> n970;
n970 [label="CALL inc", shape=box, style=filled, color=orange];
n970 -> n953;
n970 -> n972;
n959 -> n973 [label="F"];
n973 [label="a", shape=box];
n973 -> n974;
n974 [label="1", shape=box];
n974 -> n975;
n975 [label="CALL mult", shape=box, style=filled, color=orange];
n975 -> n945;
n975 -> n977;
n979 -> n981;
n993 -> n995;
n995 [label="RET add", shape=box, style=filled, color=orange];
n948 -> n995;
n946 -> n987;
n987 [label="RET mult", shape=box, style=filled, color=orange];
n987 -> n988;
n988 [label="4", shape=box];
n988 -> n989;
n989 [label="5", shape=box];
n989 -> n990;
n990 [label="CALL add", shape=box, style=filled, color=orange];
n990 -> n947;
n990 -> n992;
n985 -> n987;
}

View File

@@ -0,0 +1,11 @@
digraph CFG {
node [fontname="Helvetica"];
n1026 [label="START", shape=box];
n1026 -> n1028;
n1028 [label="True", shape=box];
n1028 -> n1029;
n1029 [label="<?>", shape=diamond];
n1029 -> n1031 [label="T"];
n1031 [label="3", shape=box];
n1031 -> n1026;
}

View File

@@ -0,0 +1,50 @@
digraph CFG {
node [fontname="Helvetica"];
n997 [label="START", shape=box];
n997 -> n1020;
n1020 [label="10", shape=box];
n1020 -> n1021;
n1021 [label="8", shape=box];
n1021 -> n1022;
n1022 [label="CALL func", shape=box, style=filled, color=orange];
n1022 -> n999;
n999 [label="START func(a, b)", shape=box, style=filled, color=green];
n999 -> n1002;
n1002 [label="a", shape=box];
n1002 -> n1003;
n1003 [label="0", shape=box];
n1003 -> n1004;
n1004 [label="a > 0", shape=box];
n1004 -> n1005;
n1005 [label="b", shape=box];
n1005 -> n1006;
n1006 [label="a", shape=box];
n1006 -> n1007;
n1007 [label="b != a", shape=box];
n1007 -> n1008;
n1008 [label="(a > 0) && (b != a)", shape=box];
n1008 -> n1009;
n1009 [label="<?>", shape=diamond];
n1009 -> n1000 [label="T"];
n1000 [label="END func(a, b)", shape=box, style=filled, color=green];
n1000 -> n1024;
n1024 [label="RET func", shape=box, style=filled, color=orange];
n1009 -> n1011 [label="F"];
n1011 [label="b", shape=box];
n1011 -> n1012;
n1012 [label="1", shape=box];
n1012 -> n1013;
n1013 [label="b + 1", shape=box];
n1013 -> n1014;
n1014 [label="b = (b + 1)", shape=box];
n1014 -> n1015;
n1015 [label="a", shape=box];
n1015 -> n1016;
n1016 [label="1", shape=box];
n1016 -> n1017;
n1017 [label="a - 1", shape=box];
n1017 -> n1018;
n1018 [label="a = (a - 1)", shape=box];
n1018 -> n1004;
n1022 -> n1024;
}

View File

@@ -0,0 +1,76 @@
digraph CFG {
node [fontname="Helvetica"];
n1033 [label="START", shape=box];
n1033 -> n1075;
n1075 [label="21", shape=box];
n1075 -> n1076;
n1076 [label="49", shape=box];
n1076 -> n1077;
n1077 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1077 -> n1035;
n1035 [label="START wrapper(a, b)", shape=box, style=filled, color=green];
n1035 -> n1070;
n1070 [label="0", shape=box];
n1070 -> n1071;
n1071 [label="CALL ggt", shape=box, style=filled, color=orange];
n1071 -> n1038;
n1038 [label="START ggt(noneSense)", shape=box, style=filled, color=green];
n1038 -> n1041;
n1041 [label="a", shape=box];
n1041 -> n1042;
n1042 [label="b", shape=box];
n1042 -> n1043;
n1043 [label="a == b", shape=box];
n1043 -> n1044;
n1044 [label="<?>", shape=diamond];
n1044 -> n1048 [label="T"];
n1048 [label="a", shape=box];
n1048 -> n1039;
n1039 [label="END ggt(noneSense)", shape=box, style=filled, color=green];
n1039 -> n1073;
n1073 [label="RET ggt", shape=box, style=filled, color=orange];
n1073 -> n1036;
n1036 [label="END wrapper(a, b)", shape=box, style=filled, color=green];
n1036 -> n1062;
n1062 [label="RET wrapper", shape=box, style=filled, color=orange];
n1062 -> n1039;
n1036 -> n1069;
n1069 [label="RET wrapper", shape=box, style=filled, color=orange];
n1069 -> n1039;
n1036 -> n1079;
n1079 [label="RET wrapper", shape=box, style=filled, color=orange];
n1044 -> n1049 [label="F"];
n1049 [label="a", shape=box];
n1049 -> n1050;
n1050 [label="b", shape=box];
n1050 -> n1051;
n1051 [label="a > b", shape=box];
n1051 -> n1052;
n1052 [label="<?>", shape=diamond];
n1052 -> n1056 [label="T"];
n1056 [label="a", shape=box];
n1056 -> n1057;
n1057 [label="b", shape=box];
n1057 -> n1058;
n1058 [label="a - b", shape=box];
n1058 -> n1059;
n1059 [label="b", shape=box];
n1059 -> n1060;
n1060 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1060 -> n1035;
n1060 -> n1062;
n1052 -> n1063 [label="F"];
n1063 [label="b", shape=box];
n1063 -> n1064;
n1064 [label="a", shape=box];
n1064 -> n1065;
n1065 [label="b - a", shape=box];
n1065 -> n1066;
n1066 [label="a", shape=box];
n1066 -> n1067;
n1067 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1067 -> n1035;
n1067 -> n1069;
n1071 -> n1073;
n1077 -> n1079;
}

View File

@@ -0,0 +1,49 @@
digraph CFG {
node [fontname="Helvetica"];
n1081 [label="START", shape=box];
n1081 -> n1107;
n1107 [label="4", shape=box];
n1107 -> n1108;
n1108 [label="10", shape=box];
n1108 -> n1109;
n1109 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1109 -> n1083;
n1083 [label="START wrapper(number, threshold)", shape=box, style=filled, color=green];
n1083 -> n1102;
n1102 [label="number", shape=box];
n1102 -> n1103;
n1103 [label="CALL square", shape=box, style=filled, color=orange];
n1103 -> n1086;
n1086 [label="START square(x)", shape=box, style=filled, color=green];
n1086 -> n1089;
n1089 [label="x", shape=box];
n1089 -> n1090;
n1090 [label="x", shape=box];
n1090 -> n1091;
n1091 [label="x * x", shape=box];
n1091 -> n1092;
n1092 [label="threshold", shape=box];
n1092 -> n1093;
n1093 [label="(x * x) > threshold", shape=box];
n1093 -> n1094;
n1094 [label="<?>", shape=diamond];
n1094 -> n1098 [label="T"];
n1098 [label="x", shape=box];
n1098 -> n1087;
n1087 [label="END square(x)", shape=box, style=filled, color=green];
n1087 -> n1105;
n1105 [label="RET square", shape=box, style=filled, color=orange];
n1105 -> n1084;
n1084 [label="END wrapper(number, threshold)", shape=box, style=filled, color=green];
n1084 -> n1111;
n1111 [label="RET wrapper", shape=box, style=filled, color=orange];
n1094 -> n1099 [label="F"];
n1099 [label="x", shape=box];
n1099 -> n1100;
n1100 [label="x", shape=box];
n1100 -> n1101;
n1101 [label="x * x", shape=box];
n1101 -> n1087;
n1103 -> n1105;
n1109 -> n1111;
}

View File

@@ -0,0 +1,19 @@
digraph CFG {
node [fontname="Helvetica"];
n7 [label="1", shape=box];
n7 -> n8;
n8 [label="2", shape=box];
n8 -> n9;
n9 [label="3", shape=box];
n9 -> n10;
n10 [label="CALL a", shape=box, style=filled, color=orange];
n10 -> n3;
n3 [label="START a(x, y, z)", shape=box, style=filled, color=green];
n3 -> n6;
n6 [label="x", shape=box];
n6 -> n4;
n4 [label="END a(x, y, z)", shape=box, style=filled, color=green];
n4 -> n12;
n12 [label="RET a", shape=box, style=filled, color=orange];
n10 -> n12;
}

View File

@@ -0,0 +1,123 @@
digraph CFG {
node [fontname="Helvetica"];
n65 [label="10", shape=box];
n65 -> n66;
n66 [label="CALL f1", shape=box, style=filled, color=orange];
n66 -> n16;
n16 [label="START f1(b)", shape=box, style=filled, color=green];
n16 -> n21;
n21 [label="b", shape=box];
n21 -> n22;
n22 [label="0", shape=box];
n22 -> n23;
n23 [label="b == 0", shape=box];
n23 -> n24;
n24 [label="<?>", shape=diamond];
n24 -> n28 [label="T"];
n28 [label="0", shape=box];
n28 -> n17;
n17 [label="END f1(b)", shape=box, style=filled, color=green];
n17 -> n34;
n34 [label="RET f1", shape=box, style=filled, color=orange];
n34 -> n17;
n17 -> n45;
n45 [label="RET f1", shape=box, style=filled, color=orange];
n45 -> n58;
n58 [label="a", shape=box];
n58 -> n59;
n59 [label="b", shape=box];
n59 -> n60;
n60 [label="a * b", shape=box];
n60 -> n61;
n61 [label="CALL g", shape=box, style=filled, color=orange];
n61 -> n50;
n50 [label="START g(c)", shape=box, style=filled, color=green];
n50 -> n53;
n53 [label="a", shape=box];
n53 -> n54;
n54 [label="b", shape=box];
n54 -> n55;
n55 [label="a * b", shape=box];
n55 -> n56;
n56 [label="c", shape=box];
n56 -> n57;
n57 [label="(a * b) * c", shape=box];
n57 -> n51;
n51 [label="END g(c)", shape=box, style=filled, color=green];
n51 -> n63;
n63 [label="RET g", shape=box, style=filled, color=orange];
n63 -> n19;
n19 [label="END f2(a, b)", shape=box, style=filled, color=green];
n19 -> n91;
n91 [label="RET f2", shape=box, style=filled, color=orange];
n61 -> n63;
n17 -> n49;
n49 [label="RET f1", shape=box, style=filled, color=orange];
n49 -> n58;
n17 -> n68;
n68 [label="RET f1", shape=box, style=filled, color=orange];
n68 -> n70;
n70 [label="10", shape=box];
n70 -> n83;
n83 [label="20", shape=box];
n83 -> n84;
n84 [label="30", shape=box];
n84 -> n85;
n85 [label="CALL max", shape=box, style=filled, color=orange];
n85 -> n71;
n71 [label="START max(a, b)", shape=box, style=filled, color=green];
n71 -> n74;
n74 [label="a", shape=box];
n74 -> n75;
n75 [label="b", shape=box];
n75 -> n76;
n76 [label="a > b", shape=box];
n76 -> n77;
n77 [label="<?>", shape=diamond];
n77 -> n81 [label="T"];
n81 [label="a", shape=box];
n81 -> n72;
n72 [label="END max(a, b)", shape=box, style=filled, color=green];
n72 -> n87;
n87 [label="RET max", shape=box, style=filled, color=orange];
n87 -> n89;
n89 [label="CALL f2", shape=box, style=filled, color=orange];
n89 -> n18;
n18 [label="START f2(a, b)", shape=box, style=filled, color=green];
n18 -> n35;
n35 [label="a", shape=box];
n35 -> n36;
n36 [label="b", shape=box];
n36 -> n37;
n37 [label="a > b", shape=box];
n37 -> n38;
n38 [label="<?>", shape=diamond];
n38 -> n42 [label="T"];
n42 [label="a", shape=box];
n42 -> n43;
n43 [label="CALL f1", shape=box, style=filled, color=orange];
n43 -> n16;
n43 -> n45;
n38 -> n46 [label="F"];
n46 [label="b", shape=box];
n46 -> n47;
n47 [label="CALL f1", shape=box, style=filled, color=orange];
n47 -> n16;
n47 -> n49;
n89 -> n91;
n77 -> n82 [label="F"];
n82 [label="b", shape=box];
n82 -> n72;
n85 -> n87;
n24 -> n29 [label="F"];
n29 [label="b", shape=box];
n29 -> n30;
n30 [label="1", shape=box];
n30 -> n31;
n31 [label="b - 1", shape=box];
n31 -> n32;
n32 [label="CALL f1", shape=box, style=filled, color=orange];
n32 -> n16;
n32 -> n34;
n66 -> n68;
}

View File

@@ -0,0 +1,22 @@
digraph CFG {
node [fontname="Helvetica"];
n94 [label="2", shape=box];
n94 -> n95;
n95 [label="x", shape=box];
n95 -> n96;
n96 [label="2 < x", shape=box];
n96 -> n97;
n97 [label="x", shape=box];
n97 -> n98;
n98 [label="9", shape=box];
n98 -> n99;
n99 [label="x > 9", shape=box];
n99 -> n100;
n100 [label="(2 < x) && (x > 9)", shape=box];
n100 -> n101;
n101 [label="<?>", shape=diamond];
n101 -> n105 [label="T"];
n105 [label="1", shape=box];
n101 -> n106 [label="F"];
n106 [label="0", shape=box];
}

View File

@@ -0,0 +1,41 @@
digraph CFG {
node [fontname="Helvetica"];
n119 [label="1", shape=box];
n119 -> n120;
n120 [label="CALL a", shape=box, style=filled, color=orange];
n120 -> n109;
n109 [label="START a(x)", shape=box, style=filled, color=green];
n109 -> n116;
n116 [label="x", shape=box];
n116 -> n110;
n110 [label="END a(x)", shape=box, style=filled, color=green];
n110 -> n122;
n122 [label="RET a", shape=box, style=filled, color=orange];
n122 -> n124;
n124 [label="2", shape=box];
n124 -> n125;
n125 [label="CALL b", shape=box, style=filled, color=orange];
n125 -> n111;
n111 [label="START b(y)", shape=box, style=filled, color=green];
n111 -> n117;
n117 [label="y", shape=box];
n117 -> n112;
n112 [label="END b(y)", shape=box, style=filled, color=green];
n112 -> n127;
n127 [label="RET b", shape=box, style=filled, color=orange];
n127 -> n128;
n128 [label="3", shape=box];
n128 -> n129;
n129 [label="CALL c", shape=box, style=filled, color=orange];
n129 -> n113;
n113 [label="START c(z)", shape=box, style=filled, color=green];
n113 -> n118;
n118 [label="z", shape=box];
n118 -> n114;
n114 [label="END c(z)", shape=box, style=filled, color=green];
n114 -> n131;
n131 [label="RET c", shape=box, style=filled, color=orange];
n129 -> n131;
n125 -> n127;
n120 -> n122;
}

View File

@@ -0,0 +1,66 @@
digraph CFG {
node [fontname="Helvetica"];
n167 [label="2", shape=box];
n167 -> n168;
n168 [label="3", shape=box];
n168 -> n169;
n169 [label="CALL f", shape=box, style=filled, color=orange];
n169 -> n134;
n134 [label="START f(x, y, z)", shape=box, style=filled, color=green];
n134 -> n137;
n137 [label="2", shape=box];
n137 -> n138;
n138 [label="y = 2", shape=box];
n138 -> n139;
n139 [label="3", shape=box];
n139 -> n140;
n140 [label="z = 3", shape=box];
n140 -> n160;
n160 [label="x", shape=box];
n160 -> n161;
n161 [label="CALL g", shape=box, style=filled, color=orange];
n161 -> n141;
n141 [label="START g(x)", shape=box, style=filled, color=green];
n141 -> n144;
n144 [label="7", shape=box];
n144 -> n145;
n145 [label="x = 7", shape=box];
n145 -> n146;
n146 [label="y", shape=box];
n146 -> n147;
n147 [label="0", shape=box];
n147 -> n148;
n148 [label="y > 0", shape=box];
n148 -> n149;
n149 [label="<?>", shape=diamond];
n149 -> n153 [label="T"];
n153 [label="y", shape=box];
n153 -> n154;
n154 [label="CALL g", shape=box, style=filled, color=orange];
n154 -> n141;
n154 -> n156;
n156 [label="RET g", shape=box, style=filled, color=orange];
n156 -> n159;
n159 [label="x", shape=box];
n159 -> n142;
n142 [label="END g(x)", shape=box, style=filled, color=green];
n142 -> n156;
n142 -> n163;
n163 [label="RET g", shape=box, style=filled, color=orange];
n163 -> n164;
n164 [label="x", shape=box];
n164 -> n165;
n165 [label="g(x) + x", shape=box];
n165 -> n135;
n135 [label="END f(x, y, z)", shape=box, style=filled, color=green];
n135 -> n171;
n171 [label="RET f", shape=box, style=filled, color=orange];
n165 -> n135;
n149 -> n157 [label="F"];
n157 [label="8", shape=box];
n157 -> n158;
n158 [label="x = 8", shape=box];
n158 -> n159;
n161 -> n163;
n169 -> n171;
}

View File

@@ -0,0 +1,264 @@
digraph CFG {
node [fontname="Helvetica"];
n338 [label="3", shape=box];
n338 -> n339;
n339 [label="CALL fac", shape=box, style=filled, color=orange];
n339 -> n191;
n191 [label="START fac(x)", shape=box, style=filled, color=green];
n191 -> n194;
n194 [label="x", shape=box];
n194 -> n195;
n195 [label="1", shape=box];
n195 -> n196;
n196 [label="x == 1", shape=box];
n196 -> n197;
n197 [label="<?>", shape=diamond];
n197 -> n201 [label="T"];
n201 [label="1", shape=box];
n201 -> n192;
n192 [label="END fac(x)", shape=box, style=filled, color=green];
n192 -> n207;
n207 [label="RET fac", shape=box, style=filled, color=orange];
n207 -> n208;
n208 [label="x", shape=box];
n208 -> n209;
n209 [label="fac((x - 1)) * x", shape=box];
n209 -> n192;
n192 -> n223;
n223 [label="RET fac", shape=box, style=filled, color=orange];
n223 -> n224;
n224 [label="x", shape=box];
n224 -> n225;
n225 [label="fac((x - 1)) * x", shape=box];
n225 -> n192;
n192 -> n239;
n239 [label="RET fac", shape=box, style=filled, color=orange];
n239 -> n240;
n240 [label="x", shape=box];
n240 -> n241;
n241 [label="fac((x - 1)) * x", shape=box];
n241 -> n192;
n192 -> n255;
n255 [label="RET fac", shape=box, style=filled, color=orange];
n255 -> n256;
n256 [label="x", shape=box];
n256 -> n257;
n257 [label="fac((x - 1)) * x", shape=box];
n257 -> n192;
n192 -> n271;
n271 [label="RET fac", shape=box, style=filled, color=orange];
n271 -> n272;
n272 [label="x", shape=box];
n272 -> n273;
n273 [label="fac((x - 1)) * x", shape=box];
n273 -> n192;
n192 -> n287;
n287 [label="RET fac", shape=box, style=filled, color=orange];
n287 -> n288;
n288 [label="x", shape=box];
n288 -> n289;
n289 [label="fac((x - 1)) * x", shape=box];
n289 -> n192;
n192 -> n303;
n303 [label="RET fac", shape=box, style=filled, color=orange];
n303 -> n304;
n304 [label="x", shape=box];
n304 -> n305;
n305 [label="fac((x - 1)) * x", shape=box];
n305 -> n192;
n192 -> n319;
n319 [label="RET fac", shape=box, style=filled, color=orange];
n319 -> n320;
n320 [label="x", shape=box];
n320 -> n321;
n321 [label="fac((x - 1)) * x", shape=box];
n321 -> n192;
n192 -> n335;
n335 [label="RET fac", shape=box, style=filled, color=orange];
n335 -> n336;
n336 [label="x", shape=box];
n336 -> n337;
n337 [label="fac((x - 1)) * x", shape=box];
n337 -> n192;
n192 -> n341;
n341 [label="RET fac", shape=box, style=filled, color=orange];
n197 -> n202 [label="F"];
n202 [label="x", shape=box];
n202 -> n203;
n203 [label="1", shape=box];
n203 -> n204;
n204 [label="x - 1", shape=box];
n204 -> n205;
n205 [label="CALL fac", shape=box, style=filled, color=orange];
n205 -> n191;
n205 -> n207;
n191 -> n210;
n210 [label="x", shape=box];
n210 -> n211;
n211 [label="1", shape=box];
n211 -> n212;
n212 [label="x == 1", shape=box];
n212 -> n213;
n213 [label="<?>", shape=diamond];
n213 -> n217 [label="T"];
n217 [label="1", shape=box];
n217 -> n192;
n213 -> n218 [label="F"];
n218 [label="x", shape=box];
n218 -> n219;
n219 [label="1", shape=box];
n219 -> n220;
n220 [label="x - 1", shape=box];
n220 -> n221;
n221 [label="CALL fac", shape=box, style=filled, color=orange];
n221 -> n191;
n221 -> n223;
n191 -> n226;
n226 [label="x", shape=box];
n226 -> n227;
n227 [label="1", shape=box];
n227 -> n228;
n228 [label="x == 1", shape=box];
n228 -> n229;
n229 [label="<?>", shape=diamond];
n229 -> n233 [label="T"];
n233 [label="1", shape=box];
n233 -> n192;
n229 -> n234 [label="F"];
n234 [label="x", shape=box];
n234 -> n235;
n235 [label="1", shape=box];
n235 -> n236;
n236 [label="x - 1", shape=box];
n236 -> n237;
n237 [label="CALL fac", shape=box, style=filled, color=orange];
n237 -> n191;
n237 -> n239;
n191 -> n242;
n242 [label="x", shape=box];
n242 -> n243;
n243 [label="1", shape=box];
n243 -> n244;
n244 [label="x == 1", shape=box];
n244 -> n245;
n245 [label="<?>", shape=diamond];
n245 -> n249 [label="T"];
n249 [label="1", shape=box];
n249 -> n192;
n245 -> n250 [label="F"];
n250 [label="x", shape=box];
n250 -> n251;
n251 [label="1", shape=box];
n251 -> n252;
n252 [label="x - 1", shape=box];
n252 -> n253;
n253 [label="CALL fac", shape=box, style=filled, color=orange];
n253 -> n191;
n253 -> n255;
n191 -> n258;
n258 [label="x", shape=box];
n258 -> n259;
n259 [label="1", shape=box];
n259 -> n260;
n260 [label="x == 1", shape=box];
n260 -> n261;
n261 [label="<?>", shape=diamond];
n261 -> n265 [label="T"];
n265 [label="1", shape=box];
n265 -> n192;
n261 -> n266 [label="F"];
n266 [label="x", shape=box];
n266 -> n267;
n267 [label="1", shape=box];
n267 -> n268;
n268 [label="x - 1", shape=box];
n268 -> n269;
n269 [label="CALL fac", shape=box, style=filled, color=orange];
n269 -> n191;
n269 -> n271;
n191 -> n274;
n274 [label="x", shape=box];
n274 -> n275;
n275 [label="1", shape=box];
n275 -> n276;
n276 [label="x == 1", shape=box];
n276 -> n277;
n277 [label="<?>", shape=diamond];
n277 -> n281 [label="T"];
n281 [label="1", shape=box];
n281 -> n192;
n277 -> n282 [label="F"];
n282 [label="x", shape=box];
n282 -> n283;
n283 [label="1", shape=box];
n283 -> n284;
n284 [label="x - 1", shape=box];
n284 -> n285;
n285 [label="CALL fac", shape=box, style=filled, color=orange];
n285 -> n191;
n285 -> n287;
n191 -> n290;
n290 [label="x", shape=box];
n290 -> n291;
n291 [label="1", shape=box];
n291 -> n292;
n292 [label="x == 1", shape=box];
n292 -> n293;
n293 [label="<?>", shape=diamond];
n293 -> n297 [label="T"];
n297 [label="1", shape=box];
n297 -> n192;
n293 -> n298 [label="F"];
n298 [label="x", shape=box];
n298 -> n299;
n299 [label="1", shape=box];
n299 -> n300;
n300 [label="x - 1", shape=box];
n300 -> n301;
n301 [label="CALL fac", shape=box, style=filled, color=orange];
n301 -> n191;
n301 -> n303;
n191 -> n306;
n306 [label="x", shape=box];
n306 -> n307;
n307 [label="1", shape=box];
n307 -> n308;
n308 [label="x == 1", shape=box];
n308 -> n309;
n309 [label="<?>", shape=diamond];
n309 -> n313 [label="T"];
n313 [label="1", shape=box];
n313 -> n192;
n309 -> n314 [label="F"];
n314 [label="x", shape=box];
n314 -> n315;
n315 [label="1", shape=box];
n315 -> n316;
n316 [label="x - 1", shape=box];
n316 -> n317;
n317 [label="CALL fac", shape=box, style=filled, color=orange];
n317 -> n191;
n317 -> n319;
n191 -> n322;
n322 [label="x", shape=box];
n322 -> n323;
n323 [label="1", shape=box];
n323 -> n324;
n324 [label="x == 1", shape=box];
n324 -> n325;
n325 [label="<?>", shape=diamond];
n325 -> n329 [label="T"];
n329 [label="1", shape=box];
n329 -> n192;
n325 -> n330 [label="F"];
n330 [label="x", shape=box];
n330 -> n331;
n331 [label="1", shape=box];
n331 -> n332;
n332 [label="x - 1", shape=box];
n332 -> n333;
n333 [label="CALL fac", shape=box, style=filled, color=orange];
n333 -> n191;
n333 -> n335;
n339 -> n341;
}

View File

@@ -0,0 +1,4 @@
digraph CFG {
node [fontname="Helvetica"];
n358 [label="0", shape=box];
}

View File

@@ -0,0 +1,48 @@
digraph CFG {
node [fontname="Helvetica"];
n382 [label="10", shape=box];
n382 -> n383;
n383 [label="8", shape=box];
n383 -> n384;
n384 [label="CALL func", shape=box, style=filled, color=orange];
n384 -> n361;
n361 [label="START func(a, b)", shape=box, style=filled, color=green];
n361 -> n364;
n364 [label="a", shape=box];
n364 -> n365;
n365 [label="0", shape=box];
n365 -> n366;
n366 [label="a > 0", shape=box];
n366 -> n367;
n367 [label="b", shape=box];
n367 -> n368;
n368 [label="a", shape=box];
n368 -> n369;
n369 [label="b != a", shape=box];
n369 -> n370;
n370 [label="(a > 0) && (b != a)", shape=box];
n370 -> n371;
n371 [label="<?>", shape=diamond];
n371 -> n373 [label="T"];
n373 [label="b", shape=box];
n373 -> n374;
n374 [label="1", shape=box];
n374 -> n375;
n375 [label="b + 1", shape=box];
n375 -> n376;
n376 [label="b = (b + 1)", shape=box];
n376 -> n377;
n377 [label="a", shape=box];
n377 -> n378;
n378 [label="1", shape=box];
n378 -> n379;
n379 [label="a - 1", shape=box];
n379 -> n380;
n380 [label="a = (a - 1)", shape=box];
n380 -> n366;
n371 -> n362 [label="F"];
n362 [label="END func(a, b)", shape=box, style=filled, color=green];
n362 -> n386;
n386 [label="RET func", shape=box, style=filled, color=orange];
n384 -> n386;
}

View File

@@ -0,0 +1,14 @@
digraph CFG {
node [fontname="Helvetica"];
n390 [label="1", shape=box];
n390 -> n391;
n391 [label="0", shape=box];
n391 -> n392;
n392 [label="1 >= 0", shape=box];
n392 -> n393;
n393 [label="<?>", shape=diamond];
n393 -> n397 [label="T"];
n397 [label="1", shape=box];
n393 -> n398 [label="F"];
n398 [label="0", shape=box];
}

View File

@@ -0,0 +1,63 @@
digraph CFG {
node [fontname="Helvetica"];
n439 [label="3528", shape=box];
n439 -> n440;
n440 [label="3780", shape=box];
n440 -> n441;
n441 [label="CALL ggT", shape=box, style=filled, color=orange];
n441 -> n407;
n407 [label="START ggT(a, b)", shape=box, style=filled, color=green];
n407 -> n410;
n410 [label="a", shape=box];
n410 -> n411;
n411 [label="b", shape=box];
n411 -> n412;
n412 [label="a == b", shape=box];
n412 -> n413;
n413 [label="<?>", shape=diamond];
n413 -> n417 [label="T"];
n417 [label="a", shape=box];
n417 -> n408;
n408 [label="END ggT(a, b)", shape=box, style=filled, color=green];
n408 -> n431;
n431 [label="RET ggT", shape=box, style=filled, color=orange];
n431 -> n408;
n408 -> n438;
n438 [label="RET ggT", shape=box, style=filled, color=orange];
n438 -> n408;
n408 -> n443;
n443 [label="RET ggT", shape=box, style=filled, color=orange];
n413 -> n418 [label="F"];
n418 [label="a", shape=box];
n418 -> n419;
n419 [label="b", shape=box];
n419 -> n420;
n420 [label="a > b", shape=box];
n420 -> n421;
n421 [label="<?>", shape=diamond];
n421 -> n425 [label="T"];
n425 [label="a", shape=box];
n425 -> n426;
n426 [label="b", shape=box];
n426 -> n427;
n427 [label="a - b", shape=box];
n427 -> n428;
n428 [label="b", shape=box];
n428 -> n429;
n429 [label="CALL ggT", shape=box, style=filled, color=orange];
n429 -> n407;
n429 -> n431;
n421 -> n432 [label="F"];
n432 [label="b", shape=box];
n432 -> n433;
n433 [label="a", shape=box];
n433 -> n434;
n434 [label="b - a", shape=box];
n434 -> n435;
n435 [label="a", shape=box];
n435 -> n436;
n436 [label="CALL ggT", shape=box, style=filled, color=orange];
n436 -> n407;
n436 -> n438;
n441 -> n443;
}

View File

@@ -0,0 +1,108 @@
digraph CFG {
node [fontname="Helvetica"];
n499 [label="1", shape=box];
n499 -> n500;
n500 [label="2", shape=box];
n500 -> n501;
n501 [label="CALL f", shape=box, style=filled, color=orange];
n501 -> n447;
n447 [label="START f(x, y)", shape=box, style=filled, color=green];
n447 -> n452;
n452 [label="x", shape=box];
n452 -> n453;
n453 [label="0", shape=box];
n453 -> n454;
n454 [label="x == 0", shape=box];
n454 -> n455;
n455 [label="<?>", shape=diamond];
n455 -> n467 [label="T"];
n467 [label="2", shape=box];
n467 -> n468;
n468 [label="y", shape=box];
n468 -> n469;
n469 [label="2 * y", shape=box];
n469 -> n470;
n470 [label="x", shape=box];
n470 -> n471;
n471 [label="CALL g", shape=box, style=filled, color=orange];
n471 -> n459;
n459 [label="START g(x, z)", shape=box, style=filled, color=green];
n459 -> n462;
n462 [label="x", shape=box];
n462 -> n463;
n463 [label="y", shape=box];
n463 -> n464;
n464 [label="x * y", shape=box];
n464 -> n465;
n465 [label="z", shape=box];
n465 -> n466;
n466 [label="(x * y) + z", shape=box];
n466 -> n460;
n460 [label="END g(x, z)", shape=box, style=filled, color=green];
n460 -> n473;
n473 [label="RET g", shape=box, style=filled, color=orange];
n473 -> n448;
n448 [label="END f(x, y)", shape=box, style=filled, color=green];
n448 -> n488;
n488 [label="RET f", shape=box, style=filled, color=orange];
n488 -> n489;
n489 [label="a * f(a,i)", shape=box];
n489 -> n490;
n490 [label="a = (a * f(a,i))", shape=box];
n490 -> n491;
n491 [label="i", shape=box];
n491 -> n492;
n492 [label="1", shape=box];
n492 -> n493;
n493 [label="i - 1", shape=box];
n493 -> n494;
n494 [label="i = (i - 1)", shape=box];
n494 -> n478;
n478 [label="i", shape=box];
n478 -> n479;
n479 [label="0", shape=box];
n479 -> n480;
n480 [label="i > 0", shape=box];
n480 -> n481;
n481 [label="<?>", shape=diamond];
n481 -> n483 [label="T"];
n483 [label="a", shape=box];
n483 -> n484;
n484 [label="a", shape=box];
n484 -> n485;
n485 [label="i", shape=box];
n485 -> n486;
n486 [label="CALL f", shape=box, style=filled, color=orange];
n486 -> n447;
n486 -> n488;
n481 -> n496 [label="F"];
n496 [label="a", shape=box];
n496 -> n497;
n497 [label="42", shape=box];
n497 -> n498;
n498 [label="a + 42", shape=box];
n498 -> n460;
n448 -> n503;
n503 [label="RET f", shape=box, style=filled, color=orange];
n503 -> n505;
n505 [label="3", shape=box];
n505 -> n506;
n506 [label="3", shape=box];
n506 -> n507;
n507 [label="CALL g", shape=box, style=filled, color=orange];
n507 -> n459;
n507 -> n509;
n509 [label="RET g", shape=box, style=filled, color=orange];
n473 -> n448;
n460 -> n509;
n459 -> n478;
n471 -> n473;
n455 -> n475 [label="F"];
n475 [label="x", shape=box];
n475 -> n476;
n476 [label="1", shape=box];
n476 -> n477;
n477 [label="x + 1", shape=box];
n477 -> n448;
n501 -> n503;
}

View File

@@ -0,0 +1,32 @@
digraph CFG {
node [fontname="Helvetica"];
n518 [label="5", shape=box];
n518 -> n519;
n519 [label="CALL m", shape=box, style=filled, color=orange];
n519 -> n514;
n514 [label="START m(a)", shape=box, style=filled, color=green];
n514 -> n517;
n517 [label="a", shape=box];
n517 -> n515;
n515 [label="END m(a)", shape=box, style=filled, color=green];
n515 -> n521;
n521 [label="RET m", shape=box, style=filled, color=orange];
n521 -> n529;
n529 [label="5", shape=box];
n529 -> n530;
n530 [label="CALL m", shape=box, style=filled, color=orange];
n530 -> n523;
n523 [label="START m(b)", shape=box, style=filled, color=green];
n523 -> n526;
n526 [label="b", shape=box];
n526 -> n527;
n527 [label="1", shape=box];
n527 -> n528;
n528 [label="b + 1", shape=box];
n528 -> n524;
n524 [label="END m(b)", shape=box, style=filled, color=green];
n524 -> n532;
n532 [label="RET m", shape=box, style=filled, color=orange];
n530 -> n532;
n519 -> n521;
}

View File

@@ -0,0 +1,42 @@
digraph CFG {
node [fontname="Helvetica"];
n540 [label="5", shape=box];
n540 -> n541;
n541 [label="CALL n", shape=box, style=filled, color=orange];
n541 -> n536;
n536 [label="START n(a)", shape=box, style=filled, color=green];
n536 -> n539;
n539 [label="a", shape=box];
n539 -> n537;
n537 [label="END n(a)", shape=box, style=filled, color=green];
n537 -> n543;
n543 [label="RET n", shape=box, style=filled, color=orange];
n543 -> n551;
n551 [label="5", shape=box];
n551 -> n552;
n552 [label="CALL n", shape=box, style=filled, color=orange];
n552 -> n536;
n552 -> n554;
n554 [label="RET n", shape=box, style=filled, color=orange];
n554 -> n555;
n555 [label="5", shape=box];
n555 -> n556;
n556 [label="CALL m", shape=box, style=filled, color=orange];
n556 -> n545;
n545 [label="START m(a)", shape=box, style=filled, color=green];
n545 -> n548;
n548 [label="a", shape=box];
n548 -> n549;
n549 [label="1", shape=box];
n549 -> n550;
n550 [label="a + 1", shape=box];
n550 -> n546;
n546 [label="END m(a)", shape=box, style=filled, color=green];
n546 -> n558;
n558 [label="RET m", shape=box, style=filled, color=orange];
n558 -> n559;
n559 [label="n(5) + m(5)", shape=box];
n556 -> n558;
n537 -> n554;
n541 -> n543;
}

View File

@@ -0,0 +1,18 @@
digraph CFG {
node [fontname="Helvetica"];
n563 [label="True", shape=box];
n563 -> n564;
n564 [label="True", shape=box];
n564 -> n565;
n565 [label="True", shape=box];
n565 -> n566;
n566 [label="True == True", shape=box];
n566 -> n567;
n567 [label="True || (True == True)", shape=box];
n567 -> n568;
n568 [label="<?>", shape=diamond];
n568 -> n572 [label="T"];
n572 [label="1", shape=box];
n568 -> n573 [label="F"];
n573 [label="0", shape=box];
}

View File

@@ -0,0 +1,19 @@
digraph CFG {
node [fontname="Helvetica"];
n582 [label="5", shape=box];
n582 -> n583;
n583 [label="CALL g", shape=box, style=filled, color=orange];
n583 -> n576;
n576 [label="START g(a)", shape=box, style=filled, color=green];
n576 -> n579;
n579 [label="a", shape=box];
n579 -> n580;
n580 [label="a", shape=box];
n580 -> n581;
n581 [label="a * a", shape=box];
n581 -> n577;
n577 [label="END g(a)", shape=box, style=filled, color=green];
n577 -> n585;
n585 [label="RET g", shape=box, style=filled, color=orange];
n583 -> n585;
}

View File

@@ -0,0 +1,36 @@
digraph CFG {
node [fontname="Helvetica"];
n606 [label="10", shape=box];
n606 -> n607;
n607 [label="CALL f1", shape=box, style=filled, color=orange];
n607 -> n589;
n589 [label="START f1(b)", shape=box, style=filled, color=green];
n589 -> n592;
n592 [label="b", shape=box];
n592 -> n593;
n593 [label="0", shape=box];
n593 -> n594;
n594 [label="b == 0", shape=box];
n594 -> n595;
n595 [label="<?>", shape=diamond];
n595 -> n599 [label="T"];
n599 [label="0", shape=box];
n599 -> n590;
n590 [label="END f1(b)", shape=box, style=filled, color=green];
n590 -> n605;
n605 [label="RET f1", shape=box, style=filled, color=orange];
n605 -> n590;
n590 -> n609;
n609 [label="RET f1", shape=box, style=filled, color=orange];
n595 -> n600 [label="F"];
n600 [label="b", shape=box];
n600 -> n601;
n601 [label="1", shape=box];
n601 -> n602;
n602 [label="b - 1", shape=box];
n602 -> n603;
n603 [label="CALL f1", shape=box, style=filled, color=orange];
n603 -> n589;
n603 -> n605;
n607 -> n609;
}

View File

@@ -0,0 +1,123 @@
digraph CFG {
node [fontname="Helvetica"];
n662 [label="10", shape=box];
n662 -> n663;
n663 [label="CALL f1", shape=box, style=filled, color=orange];
n663 -> n613;
n613 [label="START f1(b)", shape=box, style=filled, color=green];
n613 -> n618;
n618 [label="b", shape=box];
n618 -> n619;
n619 [label="0", shape=box];
n619 -> n620;
n620 [label="b == 0", shape=box];
n620 -> n621;
n621 [label="<?>", shape=diamond];
n621 -> n625 [label="T"];
n625 [label="0", shape=box];
n625 -> n614;
n614 [label="END f1(b)", shape=box, style=filled, color=green];
n614 -> n631;
n631 [label="RET f1", shape=box, style=filled, color=orange];
n631 -> n614;
n614 -> n642;
n642 [label="RET f1", shape=box, style=filled, color=orange];
n642 -> n655;
n655 [label="a", shape=box];
n655 -> n656;
n656 [label="b", shape=box];
n656 -> n657;
n657 [label="a * b", shape=box];
n657 -> n658;
n658 [label="CALL g", shape=box, style=filled, color=orange];
n658 -> n647;
n647 [label="START g(c)", shape=box, style=filled, color=green];
n647 -> n650;
n650 [label="a", shape=box];
n650 -> n651;
n651 [label="b", shape=box];
n651 -> n652;
n652 [label="a * b", shape=box];
n652 -> n653;
n653 [label="c", shape=box];
n653 -> n654;
n654 [label="(a * b) * c", shape=box];
n654 -> n648;
n648 [label="END g(c)", shape=box, style=filled, color=green];
n648 -> n660;
n660 [label="RET g", shape=box, style=filled, color=orange];
n660 -> n616;
n616 [label="END f2(a, b)", shape=box, style=filled, color=green];
n616 -> n688;
n688 [label="RET f2", shape=box, style=filled, color=orange];
n658 -> n660;
n614 -> n646;
n646 [label="RET f1", shape=box, style=filled, color=orange];
n646 -> n655;
n614 -> n665;
n665 [label="RET f1", shape=box, style=filled, color=orange];
n665 -> n667;
n667 [label="10", shape=box];
n667 -> n680;
n680 [label="20", shape=box];
n680 -> n681;
n681 [label="30", shape=box];
n681 -> n682;
n682 [label="CALL max", shape=box, style=filled, color=orange];
n682 -> n668;
n668 [label="START max(a, b)", shape=box, style=filled, color=green];
n668 -> n671;
n671 [label="a", shape=box];
n671 -> n672;
n672 [label="b", shape=box];
n672 -> n673;
n673 [label="a > b", shape=box];
n673 -> n674;
n674 [label="<?>", shape=diamond];
n674 -> n678 [label="T"];
n678 [label="a", shape=box];
n678 -> n669;
n669 [label="END max(a, b)", shape=box, style=filled, color=green];
n669 -> n684;
n684 [label="RET max", shape=box, style=filled, color=orange];
n684 -> n686;
n686 [label="CALL f2", shape=box, style=filled, color=orange];
n686 -> n615;
n615 [label="START f2(a, b)", shape=box, style=filled, color=green];
n615 -> n632;
n632 [label="a", shape=box];
n632 -> n633;
n633 [label="b", shape=box];
n633 -> n634;
n634 [label="a > b", shape=box];
n634 -> n635;
n635 [label="<?>", shape=diamond];
n635 -> n639 [label="T"];
n639 [label="a", shape=box];
n639 -> n640;
n640 [label="CALL f1", shape=box, style=filled, color=orange];
n640 -> n613;
n640 -> n642;
n635 -> n643 [label="F"];
n643 [label="b", shape=box];
n643 -> n644;
n644 [label="CALL f1", shape=box, style=filled, color=orange];
n644 -> n613;
n644 -> n646;
n686 -> n688;
n674 -> n679 [label="F"];
n679 [label="b", shape=box];
n679 -> n669;
n682 -> n684;
n621 -> n626 [label="F"];
n626 [label="b", shape=box];
n626 -> n627;
n627 [label="1", shape=box];
n627 -> n628;
n628 [label="b - 1", shape=box];
n628 -> n629;
n629 [label="CALL f1", shape=box, style=filled, color=orange];
n629 -> n613;
n629 -> n631;
n663 -> n665;
}

View File

@@ -0,0 +1,23 @@
digraph CFG {
node [fontname="Helvetica"];
n698 [label="10", shape=box];
n698 -> n699;
n699 [label="8", shape=box];
n699 -> n700;
n700 [label="CALL func", shape=box, style=filled, color=orange];
n700 -> n691;
n691 [label="START func(a, b)", shape=box, style=filled, color=green];
n691 -> n694;
n694 [label="b", shape=box];
n694 -> n695;
n695 [label="1", shape=box];
n695 -> n696;
n696 [label="b + 1", shape=box];
n696 -> n697;
n697 [label="a = (b + 1)", shape=box];
n697 -> n692;
n692 [label="END func(a, b)", shape=box, style=filled, color=green];
n692 -> n702;
n702 [label="RET func", shape=box, style=filled, color=orange];
n700 -> n702;
}

View File

@@ -0,0 +1,101 @@
digraph CFG {
node [fontname="Helvetica"];
n762 [label="2", shape=box];
n762 -> n763;
n763 [label="3", shape=box];
n763 -> n764;
n764 [label="CALL f", shape=box, style=filled, color=orange];
n764 -> n712;
n712 [label="START f(a, b)", shape=box, style=filled, color=green];
n712 -> n717;
n717 [label="a", shape=box];
n717 -> n718;
n718 [label="0", shape=box];
n718 -> n719;
n719 [label="a == 0", shape=box];
n719 -> n720;
n720 [label="<?>", shape=diamond];
n720 -> n724 [label="T"];
n724 [label="2", shape=box];
n724 -> n725;
n725 [label="b", shape=box];
n725 -> n726;
n726 [label="2 + b", shape=box];
n726 -> n713;
n713 [label="END f(a, b)", shape=box, style=filled, color=green];
n713 -> n760;
n760 [label="RET f", shape=box, style=filled, color=orange];
n760 -> n761;
n761 [label="c * f((c - 1),d)", shape=box];
n761 -> n728;
n728 [label="END g(a, c)", shape=box, style=filled, color=green];
n728 -> n740;
n740 [label="RET g", shape=box, style=filled, color=orange];
n740 -> n741;
n741 [label="2 + g(a,b)", shape=box];
n741 -> n713;
n728 -> n772;
n772 [label="RET g", shape=box, style=filled, color=orange];
n713 -> n766;
n766 [label="RET f", shape=box, style=filled, color=orange];
n766 -> n768;
n768 [label="3", shape=box];
n768 -> n769;
n769 [label="2", shape=box];
n769 -> n770;
n770 [label="CALL g", shape=box, style=filled, color=orange];
n770 -> n727;
n727 [label="START g(a, c)", shape=box, style=filled, color=green];
n727 -> n730;
n730 [label="a", shape=box];
n730 -> n731;
n731 [label="c", shape=box];
n731 -> n732;
n732 [label="a + c", shape=box];
n732 -> n733;
n733 [label="b", shape=box];
n733 -> n734;
n734 [label="(a + c) + b", shape=box];
n734 -> n728;
n727 -> n743;
n743 [label="c", shape=box];
n743 -> n744;
n744 [label="0", shape=box];
n744 -> n745;
n745 [label="c == 0", shape=box];
n745 -> n746;
n746 [label="<?>", shape=diamond];
n746 -> n750 [label="T"];
n750 [label="1", shape=box];
n750 -> n751;
n751 [label="d", shape=box];
n751 -> n752;
n752 [label="1 + d", shape=box];
n752 -> n728;
n746 -> n753 [label="F"];
n753 [label="c", shape=box];
n753 -> n754;
n754 [label="c", shape=box];
n754 -> n755;
n755 [label="1", shape=box];
n755 -> n756;
n756 [label="c - 1", shape=box];
n756 -> n757;
n757 [label="d", shape=box];
n757 -> n758;
n758 [label="CALL f", shape=box, style=filled, color=orange];
n758 -> n712;
n758 -> n760;
n770 -> n772;
n720 -> n735 [label="F"];
n735 [label="2", shape=box];
n735 -> n736;
n736 [label="a", shape=box];
n736 -> n737;
n737 [label="b", shape=box];
n737 -> n738;
n738 [label="CALL g", shape=box, style=filled, color=orange];
n738 -> n727;
n738 -> n740;
n764 -> n766;
}

View File

@@ -0,0 +1,38 @@
digraph CFG {
node [fontname="Helvetica"];
n792 [label="1", shape=box];
n792 -> n793;
n793 [label="2", shape=box];
n793 -> n794;
n794 [label="CALL f", shape=box, style=filled, color=orange];
n794 -> n775;
n775 [label="START f(x, y)", shape=box, style=filled, color=green];
n775 -> n785;
n785 [label="5", shape=box];
n785 -> n786;
n786 [label="CALL g", shape=box, style=filled, color=orange];
n786 -> n778;
n778 [label="START g(x)", shape=box, style=filled, color=green];
n778 -> n781;
n781 [label="x", shape=box];
n781 -> n782;
n782 [label="7", shape=box];
n782 -> n783;
n783 [label="x + 7", shape=box];
n783 -> n784;
n784 [label="y = (x + 7)", shape=box];
n784 -> n779;
n779 [label="END g(x)", shape=box, style=filled, color=green];
n779 -> n788;
n788 [label="RET g", shape=box, style=filled, color=orange];
n788 -> n789;
n789 [label="x = g(5)", shape=box];
n789 -> n791;
n791 [label="y", shape=box];
n791 -> n776;
n776 [label="END f(x, y)", shape=box, style=filled, color=green];
n776 -> n796;
n796 [label="RET f", shape=box, style=filled, color=orange];
n786 -> n788;
n794 -> n796;
}

View File

@@ -0,0 +1,57 @@
digraph CFG {
node [fontname="Helvetica"];
n829 [label="3", shape=box];
n829 -> n830;
n830 [label="CALL f", shape=box, style=filled, color=orange];
n830 -> n800;
n800 [label="START f(x)", shape=box, style=filled, color=green];
n800 -> n803;
n803 [label="2", shape=box];
n803 -> n804;
n804 [label="x", shape=box];
n804 -> n805;
n805 [label="2 * x", shape=box];
n805 -> n806;
n806 [label="x = (2 * x)", shape=box];
n806 -> n807;
n807 [label="x", shape=box];
n807 -> n808;
n808 [label="0", shape=box];
n808 -> n809;
n809 [label="x > 0", shape=box];
n809 -> n810;
n810 [label="<?>", shape=diamond];
n810 -> n814 [label="T"];
n814 [label="x", shape=box];
n814 -> n815;
n815 [label="1", shape=box];
n815 -> n816;
n816 [label="x - 1", shape=box];
n816 -> n817;
n817 [label="x = (x - 1)", shape=box];
n817 -> n819;
n819 [label="x", shape=box];
n819 -> n820;
n820 [label="0", shape=box];
n820 -> n821;
n821 [label="x > 0", shape=box];
n821 -> n822;
n822 [label="<?>", shape=diamond];
n822 -> n824 [label="T"];
n824 [label="x", shape=box];
n824 -> n825;
n825 [label="1", shape=box];
n825 -> n826;
n826 [label="x - 1", shape=box];
n826 -> n827;
n827 [label="x = (x - 1)", shape=box];
n827 -> n819;
n822 -> n801 [label="F"];
n801 [label="END f(x)", shape=box, style=filled, color=green];
n801 -> n832;
n832 [label="RET f", shape=box, style=filled, color=orange];
n810 -> n818 [label="F"];
n818 [label="x", shape=box];
n818 -> n819;
n830 -> n832;
}

View File

@@ -0,0 +1,19 @@
digraph CFG {
node [fontname="Helvetica"];
n842 [label="2", shape=box];
n842 -> n843;
n843 [label="CALL g", shape=box, style=filled, color=orange];
n843 -> n836;
n836 [label="START g(x, y)", shape=box, style=filled, color=green];
n836 -> n839;
n839 [label="3", shape=box];
n839 -> n840;
n840 [label="y = 3", shape=box];
n840 -> n841;
n841 [label="x", shape=box];
n841 -> n837;
n837 [label="END g(x, y)", shape=box, style=filled, color=green];
n837 -> n845;
n845 [label="RET g", shape=box, style=filled, color=orange];
n843 -> n845;
}

View File

@@ -0,0 +1,14 @@
digraph CFG {
node [fontname="Helvetica"];
n858 [label="True", shape=box];
n858 -> n859;
n859 [label="False", shape=box];
n859 -> n860;
n860 [label="True && False", shape=box];
n860 -> n861;
n861 [label="<?>", shape=diamond];
n861 -> n865 [label="T"];
n865 [label="1", shape=box];
n861 -> n866 [label="F"];
n866 [label="0", shape=box];
}

View File

@@ -0,0 +1,14 @@
digraph CFG {
node [fontname="Helvetica"];
n869 [label="True", shape=box];
n869 -> n870;
n870 [label="False", shape=box];
n870 -> n871;
n871 [label="True || False", shape=box];
n871 -> n872;
n872 [label="<?>", shape=diamond];
n872 -> n876 [label="T"];
n876 [label="1", shape=box];
n872 -> n877 [label="F"];
n877 [label="0", shape=box];
}

View File

@@ -0,0 +1,14 @@
digraph CFG {
node [fontname="Helvetica"];
n880 [label="1", shape=box];
n880 -> n881;
n881 [label="2", shape=box];
n881 -> n882;
n882 [label="1 > 2", shape=box];
n882 -> n883;
n883 [label="<?>", shape=diamond];
n883 -> n887 [label="T"];
n887 [label="1", shape=box];
n883 -> n888 [label="F"];
n888 [label="0", shape=box];
}

View File

@@ -0,0 +1,18 @@
digraph CFG {
node [fontname="Helvetica"];
n891 [label="2", shape=box];
n891 -> n892;
n892 [label="3", shape=box];
n892 -> n893;
n893 [label="5", shape=box];
n893 -> n894;
n894 [label="3 + 5", shape=box];
n894 -> n895;
n895 [label="2 > (3 + 5)", shape=box];
n895 -> n896;
n896 [label="<?>", shape=diamond];
n896 -> n900 [label="T"];
n900 [label="1", shape=box];
n896 -> n901 [label="F"];
n901 [label="0", shape=box];
}

View File

@@ -0,0 +1,22 @@
digraph CFG {
node [fontname="Helvetica"];
n904 [label="1", shape=box];
n904 -> n905;
n905 [label="2", shape=box];
n905 -> n906;
n906 [label="1 > 2", shape=box];
n906 -> n907;
n907 [label="3", shape=box];
n907 -> n908;
n908 [label="5", shape=box];
n908 -> n909;
n909 [label="3 < 5", shape=box];
n909 -> n910;
n910 [label="(1 > 2) || (3 < 5)", shape=box];
n910 -> n911;
n911 [label="<?>", shape=diamond];
n911 -> n915 [label="T"];
n915 [label="1", shape=box];
n911 -> n916 [label="F"];
n916 [label="0", shape=box];
}

View File

@@ -0,0 +1,18 @@
digraph CFG {
node [fontname="Helvetica"];
n919 [label="2", shape=box];
n919 -> n920;
n920 [label="0", shape=box];
n920 -> n921;
n921 [label="2 == 0", shape=box];
n921 -> n922;
n922 [label="False", shape=box];
n922 -> n923;
n923 [label="(2 == 0) == False", shape=box];
n923 -> n924;
n924 [label="<?>", shape=diamond];
n924 -> n928 [label="T"];
n928 [label="1", shape=box];
n924 -> n929 [label="F"];
n929 [label="0", shape=box];
}

View File

@@ -0,0 +1,10 @@
digraph CFG {
node [fontname="Helvetica"];
n849 [label="True", shape=box];
n849 -> n850;
n850 [label="<?>", shape=diamond];
n850 -> n854 [label="T"];
n854 [label="1", shape=box];
n850 -> n855 [label="F"];
n855 [label="0", shape=box];
}

View File

@@ -0,0 +1,19 @@
digraph CFG {
node [fontname="Helvetica"];
n938 [label="10", shape=box];
n938 -> n939;
n939 [label="CALL square", shape=box, style=filled, color=orange];
n939 -> n932;
n932 [label="START square(x)", shape=box, style=filled, color=green];
n932 -> n935;
n935 [label="x", shape=box];
n935 -> n936;
n936 [label="x", shape=box];
n936 -> n937;
n937 [label="x * x", shape=box];
n937 -> n933;
n933 [label="END square(x)", shape=box, style=filled, color=green];
n933 -> n941;
n941 [label="RET square", shape=box, style=filled, color=orange];
n939 -> n941;
}

View File

@@ -0,0 +1,90 @@
digraph CFG {
node [fontname="Helvetica"];
n983 [label="2", shape=box];
n983 -> n984;
n984 [label="3", shape=box];
n984 -> n985;
n985 [label="CALL mult", shape=box, style=filled, color=orange];
n985 -> n945;
n945 [label="START mult(a, b)", shape=box, style=filled, color=green];
n945 -> n950;
n950 [label="a", shape=box];
n950 -> n951;
n951 [label="b", shape=box];
n951 -> n952;
n952 [label="a * b", shape=box];
n952 -> n946;
n946 [label="END mult(a, b)", shape=box, style=filled, color=green];
n946 -> n977;
n977 [label="RET mult", shape=box, style=filled, color=orange];
n977 -> n954;
n954 [label="END inc(a)", shape=box, style=filled, color=green];
n954 -> n972;
n972 [label="RET inc", shape=box, style=filled, color=orange];
n972 -> n954;
n954 -> n981;
n981 [label="RET inc", shape=box, style=filled, color=orange];
n981 -> n948;
n948 [label="END add(a, b)", shape=box, style=filled, color=green];
n948 -> n992;
n992 [label="RET add", shape=box, style=filled, color=orange];
n992 -> n993;
n993 [label="CALL add", shape=box, style=filled, color=orange];
n993 -> n947;
n947 [label="START add(a, b)", shape=box, style=filled, color=green];
n947 -> n978;
n978 [label="a", shape=box];
n978 -> n979;
n979 [label="CALL inc", shape=box, style=filled, color=orange];
n979 -> n953;
n953 [label="START inc(a)", shape=box, style=filled, color=green];
n953 -> n956;
n956 [label="b", shape=box];
n956 -> n957;
n957 [label="0", shape=box];
n957 -> n958;
n958 [label="b != 0", shape=box];
n958 -> n959;
n959 [label="<?>", shape=diamond];
n959 -> n963 [label="T"];
n963 [label="b", shape=box];
n963 -> n964;
n964 [label="1", shape=box];
n964 -> n965;
n965 [label="b - 1", shape=box];
n965 -> n966;
n966 [label="b = (b - 1)", shape=box];
n966 -> n967;
n967 [label="a", shape=box];
n967 -> n968;
n968 [label="1", shape=box];
n968 -> n969;
n969 [label="a + 1", shape=box];
n969 -> n970;
n970 [label="CALL inc", shape=box, style=filled, color=orange];
n970 -> n953;
n970 -> n972;
n959 -> n973 [label="F"];
n973 [label="a", shape=box];
n973 -> n974;
n974 [label="1", shape=box];
n974 -> n975;
n975 [label="CALL mult", shape=box, style=filled, color=orange];
n975 -> n945;
n975 -> n977;
n979 -> n981;
n993 -> n995;
n995 [label="RET add", shape=box, style=filled, color=orange];
n948 -> n995;
n946 -> n987;
n987 [label="RET mult", shape=box, style=filled, color=orange];
n987 -> n988;
n988 [label="4", shape=box];
n988 -> n989;
n989 [label="5", shape=box];
n989 -> n990;
n990 [label="CALL add", shape=box, style=filled, color=orange];
n990 -> n947;
n990 -> n992;
n985 -> n987;
}

View File

@@ -0,0 +1,9 @@
digraph CFG {
node [fontname="Helvetica"];
n1028 [label="True", shape=box];
n1028 -> n1029;
n1029 [label="<?>", shape=diamond];
n1029 -> n1031 [label="T"];
n1031 [label="3", shape=box];
n1031 -> n1028;
}

View File

@@ -0,0 +1,48 @@
digraph CFG {
node [fontname="Helvetica"];
n1020 [label="10", shape=box];
n1020 -> n1021;
n1021 [label="8", shape=box];
n1021 -> n1022;
n1022 [label="CALL func", shape=box, style=filled, color=orange];
n1022 -> n999;
n999 [label="START func(a, b)", shape=box, style=filled, color=green];
n999 -> n1002;
n1002 [label="a", shape=box];
n1002 -> n1003;
n1003 [label="0", shape=box];
n1003 -> n1004;
n1004 [label="a > 0", shape=box];
n1004 -> n1005;
n1005 [label="b", shape=box];
n1005 -> n1006;
n1006 [label="a", shape=box];
n1006 -> n1007;
n1007 [label="b != a", shape=box];
n1007 -> n1008;
n1008 [label="(a > 0) && (b != a)", shape=box];
n1008 -> n1009;
n1009 [label="<?>", shape=diamond];
n1009 -> n1011 [label="T"];
n1011 [label="b", shape=box];
n1011 -> n1012;
n1012 [label="1", shape=box];
n1012 -> n1013;
n1013 [label="b + 1", shape=box];
n1013 -> n1014;
n1014 [label="b = (b + 1)", shape=box];
n1014 -> n1015;
n1015 [label="a", shape=box];
n1015 -> n1016;
n1016 [label="1", shape=box];
n1016 -> n1017;
n1017 [label="a - 1", shape=box];
n1017 -> n1018;
n1018 [label="a = (a - 1)", shape=box];
n1018 -> n1004;
n1009 -> n1000 [label="F"];
n1000 [label="END func(a, b)", shape=box, style=filled, color=green];
n1000 -> n1024;
n1024 [label="RET func", shape=box, style=filled, color=orange];
n1022 -> n1024;
}

View File

@@ -0,0 +1,74 @@
digraph CFG {
node [fontname="Helvetica"];
n1075 [label="21", shape=box];
n1075 -> n1076;
n1076 [label="49", shape=box];
n1076 -> n1077;
n1077 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1077 -> n1035;
n1035 [label="START wrapper(a, b)", shape=box, style=filled, color=green];
n1035 -> n1070;
n1070 [label="0", shape=box];
n1070 -> n1071;
n1071 [label="CALL ggt", shape=box, style=filled, color=orange];
n1071 -> n1038;
n1038 [label="START ggt(noneSense)", shape=box, style=filled, color=green];
n1038 -> n1041;
n1041 [label="a", shape=box];
n1041 -> n1042;
n1042 [label="b", shape=box];
n1042 -> n1043;
n1043 [label="a == b", shape=box];
n1043 -> n1044;
n1044 [label="<?>", shape=diamond];
n1044 -> n1048 [label="T"];
n1048 [label="a", shape=box];
n1048 -> n1039;
n1039 [label="END ggt(noneSense)", shape=box, style=filled, color=green];
n1039 -> n1073;
n1073 [label="RET ggt", shape=box, style=filled, color=orange];
n1073 -> n1036;
n1036 [label="END wrapper(a, b)", shape=box, style=filled, color=green];
n1036 -> n1062;
n1062 [label="RET wrapper", shape=box, style=filled, color=orange];
n1062 -> n1039;
n1036 -> n1069;
n1069 [label="RET wrapper", shape=box, style=filled, color=orange];
n1069 -> n1039;
n1036 -> n1079;
n1079 [label="RET wrapper", shape=box, style=filled, color=orange];
n1044 -> n1049 [label="F"];
n1049 [label="a", shape=box];
n1049 -> n1050;
n1050 [label="b", shape=box];
n1050 -> n1051;
n1051 [label="a > b", shape=box];
n1051 -> n1052;
n1052 [label="<?>", shape=diamond];
n1052 -> n1056 [label="T"];
n1056 [label="a", shape=box];
n1056 -> n1057;
n1057 [label="b", shape=box];
n1057 -> n1058;
n1058 [label="a - b", shape=box];
n1058 -> n1059;
n1059 [label="b", shape=box];
n1059 -> n1060;
n1060 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1060 -> n1035;
n1060 -> n1062;
n1052 -> n1063 [label="F"];
n1063 [label="b", shape=box];
n1063 -> n1064;
n1064 [label="a", shape=box];
n1064 -> n1065;
n1065 [label="b - a", shape=box];
n1065 -> n1066;
n1066 [label="a", shape=box];
n1066 -> n1067;
n1067 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1067 -> n1035;
n1067 -> n1069;
n1071 -> n1073;
n1077 -> n1079;
}

View File

@@ -0,0 +1,47 @@
digraph CFG {
node [fontname="Helvetica"];
n1107 [label="4", shape=box];
n1107 -> n1108;
n1108 [label="10", shape=box];
n1108 -> n1109;
n1109 [label="CALL wrapper", shape=box, style=filled, color=orange];
n1109 -> n1083;
n1083 [label="START wrapper(number, threshold)", shape=box, style=filled, color=green];
n1083 -> n1102;
n1102 [label="number", shape=box];
n1102 -> n1103;
n1103 [label="CALL square", shape=box, style=filled, color=orange];
n1103 -> n1086;
n1086 [label="START square(x)", shape=box, style=filled, color=green];
n1086 -> n1089;
n1089 [label="x", shape=box];
n1089 -> n1090;
n1090 [label="x", shape=box];
n1090 -> n1091;
n1091 [label="x * x", shape=box];
n1091 -> n1092;
n1092 [label="threshold", shape=box];
n1092 -> n1093;
n1093 [label="(x * x) > threshold", shape=box];
n1093 -> n1094;
n1094 [label="<?>", shape=diamond];
n1094 -> n1098 [label="T"];
n1098 [label="x", shape=box];
n1098 -> n1087;
n1087 [label="END square(x)", shape=box, style=filled, color=green];
n1087 -> n1105;
n1105 [label="RET square", shape=box, style=filled, color=orange];
n1105 -> n1084;
n1084 [label="END wrapper(number, threshold)", shape=box, style=filled, color=green];
n1084 -> n1111;
n1111 [label="RET wrapper", shape=box, style=filled, color=orange];
n1094 -> n1099 [label="F"];
n1099 [label="x", shape=box];
n1099 -> n1100;
n1100 [label="x", shape=box];
n1100 -> n1101;
n1101 [label="x * x", shape=box];
n1101 -> n1087;
n1103 -> n1105;
n1109 -> n1111;
}

View File

@@ -0,0 +1 @@
The to_dot method does a lot of additional stuff, which needs to be done in the constructor. It should not be necessary to create or modify edges or remove nodes within. Instead, to dot should ALWAYS return exactly that graph, which is stored in CFG. For this reason, rewrite the constructor and use the parse ast. init the whole ast as seen in make_cfg in main. Than filter the full graph and make the rtequired modifications. to dot is only responsible for dot file formatting! Before you start, create for each tripla program in /triplacodes a dot file in /mistraltests/before. After your modifications again generate dot files in /mistraltests/after and compare for each, that the graphs are the same as before. IT IS IMPORTANT, that the created graphs are noch different afterwards.

View File

@@ -0,0 +1,88 @@
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
# Add the current directory to Python path so we can import our modules
sys.path.insert(0, '/home/janniclas/Projekte/Construction-of-Compilers/Project-02-03-04')
import triplayacc as yacc
import cfg_build
from cfg.CFG import CFG
from cfg.CFG_Node import (CFG_START, CFG_END)
def test_cfg_refactoring():
"""Test that the CFG refactoring works correctly"""
test_files = [
'example.tripla',
'simpleSequence.tripla',
'condition.tripla',
'factorial.tripla'
]
print("Testing CFG refactoring...")
print("=" * 50)
for filename in test_files:
print(f"\nTesting {filename}...")
try:
# Reset the global FUNCTIONS registry
cfg_build.FUNCTIONS.clear()
source = Path(f'triplaprograms/{filename}').read_text()
ast = yacc.parser.parse(source)
# Create CFG the old way (without AST parameter)
start1 = CFG_START()
end1 = CFG_END()
last1 = ast.cfa(start1, end1)
if last1 is not None:
last1.add_child(end1)
cfg_old = CFG(start1, end1) # Old constructor
dot_old = cfg_old.to_dot()
# Create CFG the new way (with AST parameter)
cfg_build.FUNCTIONS.clear()
start2 = CFG_START()
end2 = CFG_END()
last2 = ast.cfa(start2, end2)
if last2 is not None:
last2.add_child(end2)
cfg_new = CFG(start2, end2, ast) # New constructor
dot_new = cfg_new.to_dot()
# Compare the outputs
if dot_old == dot_new:
print(f" ✓ PASS: DOT outputs are identical")
else:
print(f" ✗ FAIL: DOT outputs differ")
print(f" Old length: {len(dot_old)}")
print(f" New length: {len(dot_new)}")
return False
# Verify basic structure
if 'digraph CFG' not in dot_new:
print(f" ✗ FAIL: Missing graph declaration")
return False
if '->' not in dot_new:
print(f" ✗ FAIL: Missing edges")
return False
print(f" ✓ PASS: Basic structure verified")
print(f" ✓ Generated DOT with {len(dot_new)} characters")
except Exception as e:
print(f" ✗ FAIL: Exception occurred: {e}")
return False
print("\n" + "=" * 50)
print("✓ All tests passed! CFG refactoring is working correctly.")
return True
if __name__ == "__main__":
success = test_cfg_refactoring()
sys.exit(0 if success else 1)