This repository was archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsandeep.py
More file actions
executable file
·153 lines (129 loc) · 4.11 KB
/
sandeep.py
File metadata and controls
executable file
·153 lines (129 loc) · 4.11 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
if intent=='for_loop':
to_send = """for ($x = a; $x <= b; $x++) {
< Code >
} """
elif intent=='print':
to_send = """ echo " Enter your string here ! " ; """
elif intent=='nested_for':
to_send = """for ($x = a; $x <= b; $x++) {
for ($y = c; $y <= d; $y++) {
<Code>;
}
}"""
elif intent=='if_condition':
to_send = """$t = "varable";
if ($t < "Condition") {
<code>;
}"""
elif intent=='nested_if':
to_send = """$x = "variable";
$y = "Variable"
if($x=="condition") {
if($y=="condition") {
<code>;
}
}"""
elif intent=='else_if':
to_send = """$x = "variable";
if($x==a) {
<code1>;
}
else if($x==b) {
<code2>;
}
else if($x==c) {
<code3>;
}"""
elif intent=='else_condition':
to_send = """$x = "Variable";
if($x==a) {
<code1>;
}
else {
<code2>;
}"""
elif intent=='while_loop':
to_send = """while($x!="condition") {
<code>;
}"""
elif intent=='exit_loop':
to_send = """break;"""
elif_intent=='do_while_loop':
to_send = """$x = "variable";
do {
<code>;
} while($x<"condition");"""
elif_intent=='init_string':
to_send = """string $x; """
elif intent=='init_int':
to_send = """int $x; """
elif intent=='init_char':
to_send = """char name[100];"""
elif intent=='init_float':
to_send = """float $x; """
elif intent=='arith_addition':
to_send = """<?php
function add(float $x,float $y){
return $x+$y;
}
?>"""
elif intent=='arith_subtraction':
to_send = """<?php
function add(float $x,float $y){
return $x-$y;
}
?>"""
elif intent=='arith_multiplication':
to_send = """<?php
function add(float $x,float $y){
return $a*$b;
}
?>"""
elif intent=='arith_division':
to_send = """<?php
function add(float $x,float $y){
return $a/$b;
}
?>"""
elif intent=='arith_remainder':
to_send = """<?php
function add(float $x,float $y){
return $a%$b;
}
?>"""
elif intent=='def_function':
to_send = """<?php
function add(float $x,float $y){
<code>
return "Your Output";
}
add($x,$y);
?>"""
elif intent=='create_array':
to_send = """int a[100],x,b;
echo 'Enter array size:';
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
echo 'Enter array elements:';
for(x=a;x<b;x++) {
a[x]=fgets($handle);
}
echo 'Array is: ' ;
for($x=a;$x<b;$x++) {
echo $a[$x];
}"""
elif intent='switch_condition':
to_send = """$x = "variable";
switch ($x) {
case "1":
<code>;
break;
case "2":
<code>;
break;
case "3":
<code>;
break;
default:
<default return code>;
}"""