-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.py
72 lines (54 loc) · 1.84 KB
/
helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
clause_label_number = 0
clause_end_number = 0
clause_false_branch_label = 0
clause_post_conditional_number = 0
clause_while_start_number = 0
clause_while_end_number = 0
clause_for_start_number = 0
clause_for_end_number = 0
clause_for_post_expression_number = 0
def create_clause_label():
global clause_label_number
result = f"clause_{clause_label_number}"
clause_label_number += 1
return result
def create_end_label():
global clause_end_number
result = f"end_{clause_end_number}"
clause_end_number += 1
return result
def create_false_branch_label():
global clause_false_branch_label
result = f"false_branch_{clause_false_branch_label}"
clause_false_branch_label += 1
return result
def create_post_conditional_number():
global clause_post_conditional_number
result = f"post_conditional_{clause_post_conditional_number}"
clause_post_conditional_number += 1
return result
def create_clause_while_start_number():
global clause_while_start_number
result = f"while_start_{clause_while_start_number}"
clause_while_start_number += 1
return result
def create_clause_while_end_number():
global clause_while_end_number
result = f"while_end_{clause_while_end_number}"
clause_while_end_number += 1
return result
def create_clause_for_start_number():
global clause_for_start_number
result = f"for_start_{clause_for_start_number}"
clause_for_start_number += 1
return result
def create_clause_for_end_number():
global clause_for_end_number
result = f"for_end_{clause_for_end_number}"
clause_for_end_number += 1
return result
def create_clause_for_post_expression_number():
global clause_for_post_expression_number
result = f"for_post_expression_{clause_for_post_expression_number}"
clause_for_post_expression_number += 1
return result