Advertisement
Guest User

regex.py

a guest
Feb 20th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.98 KB | None | 0 0
  1. import sys, re
  2.  
  3. types = dict()
  4.  
  5. var_count = 1
  6. bool_count = 1
  7. str_count = 1
  8. method_count = 1
  9. main_found = False
  10.  
  11. first_bracket = False
  12.  
  13. f = open(sys.argv[1], 'r')
  14. out = open('inst'+sys.argv[1], 'w')
  15. out.write("import java.util.Random;\n")
  16. #method_out = open('IM.java', 'w')
  17.  
  18. #method_out.write("public void sub_method0(MyString input){\n")
  19.  
  20.  
  21. for line in f.readlines():
  22. outline = line
  23.  
  24.  
  25. line = line.split("//",1)[0]
  26.  
  27. #if line.startswith("}") and first_bracket == True:
  28. #method_out.close()
  29. # f2 = open('IM.java', 'r')
  30. # for line2 in f2.readlines():
  31. # out.write(line2)
  32. # first_bracket = False
  33. #if line.startswith("}"):
  34. # first_bracket = True
  35. #else:
  36. # first_bracket = False
  37.  
  38. if line.find("public static void main") != -1:
  39. out.write(line)
  40. continue
  41.  
  42. if line.find("while(true) {") != -1:
  43. out.write(line)
  44. out.write("eca.reset();")
  45. out.write("MyString[] fuzzed_inputs = Fuzzer.fuzz(eca.inputs);")
  46. out.write("for(int i = 0; i < fuzzed_inputs.length; i++){")
  47. continue
  48.  
  49. if line.find("stdin.readLine()") != -1:
  50. out.write("MyString input = fuzzed_inputs[i];")
  51. out.write("System.out.println(\"Fuzzing: \" + input.val);")
  52. continue
  53.  
  54. # Reset the variables.
  55. var_count = 1;
  56. bool_count = 1;
  57. str_count = 1;
  58.  
  59. bracket_closeRe = '(^\s*})'
  60. m = re.findall(r'('+bracket_closeRe+')', line)
  61. while len(m) > 0:
  62. for match in m:
  63. if len(match[1]) > 0:
  64. text = match[1]
  65. line = line.replace(text, "", 1)
  66. out.write("}\n")
  67. m = re.findall(r'('+bracket_closeRe+')', line)
  68.  
  69.  
  70. typeIntRe = '((int)(\[?\]?)\s([\w\d]+))'
  71. typeStringRe = '((String)(\[?\]?)\s([\w\d]+))'
  72. typeBoolRe = '((boolean)(\[?\]?)\s([\w\d]+))'
  73. m = re.findall(r'('+typeIntRe+'|'+typeStringRe+'|'+typeBoolRe+')', line) # find all matching sub-patterns
  74. if len(m) > 0 : # if any matching items
  75. var, val, text = "", "", ""
  76. for match in m: # for each submatch, extract the condition, the var and the val
  77. if len(match[1]) > 0: # if first kind of condition
  78. text = match[1]
  79. type = match[2]
  80. var = match[3]
  81. val = match[4]
  82. #print("type " + val + " = " + type)
  83. types[val] = type
  84. line = line.replace(type, "MyInt", 1)
  85. if len(match[5]) > 0: # if first kind of condition
  86. text = match[5]
  87. type = match[6]
  88. var = match[7]
  89. val = match[8]
  90. #print("type " + val + " = " + type)
  91. types[val] = type
  92. line = line.replace(type, "MyString", 1)
  93. if len(match[9]) > 0: # if first kind of condition
  94. text = match[9]
  95. type = match[10]
  96. var = match[11]
  97. val = match[12]
  98. #print("type " + val + " = " + type)
  99. types[val] = type
  100. line = line.replace(type, "MyBool", 1)
  101.  
  102. booleanRe1 = '([\s\[\{\,](true)[\;\}\,])' # for a354505667.equals("e"
  103. booleanRe2 = '([\s\[\{\,](false)[\;\}\,])' # for a354505667.equals("e"
  104. stringRe = '([\s\[\{\,](\"\w*\")[\;\}\,])' # for a354505667.equals("e"
  105. numberRe = '(([\s\[\{\,])(-?\d+)([\;\}\,]))' # for a354505667.equals("e"
  106. m = re.findall(r'('+booleanRe1+'|'+booleanRe2+'|'+stringRe+'|'+numberRe+')', line) # find all matching sub-patterns
  107.  
  108. while len(m) > 0 : # if any matching items
  109. #print(line)
  110. var, val, text = "", "", ""
  111. for match in m: # for each submatch, extract the condition, the var and the val
  112. if len(match[1]) > 0: # if first kind of condition
  113. text = match[1]
  114. var = match[2]
  115. line = line.replace(var, "new MyBool(" + var + ")", 1)
  116. if len(match[3]) > 0: # if first kind of condition
  117. text = match[3]
  118. var = match[4]
  119. line = line.replace(var, "new MyBool(" + var + ")", 1)
  120. if len(match[5]) > 0: # if first kind of condition
  121. text = match[5]
  122. var = match[6]
  123. #print(text)
  124. line = line.replace(var, "new MyString(" + var + ")", 1)
  125. if len(match[7]) > 0: # if first kind of condition
  126. text = match[7]
  127. beg = match[8]
  128. var = match[9]
  129. end = match[10]
  130. #print(beg)
  131. #print(var)
  132. #print(end)
  133. line = line.replace(beg+var+end, beg + "new MyInt(" + var + ")" + end, 1)
  134. m = re.findall(r'('+booleanRe1+'|'+booleanRe2+'|'+stringRe+'|'+numberRe+')', line) # find all matching sub-patterns
  135.  
  136. addRe = '((-?[\.\w\d]+)\s*\+\s*(-?[\.\w\d]+))'
  137. delRe = '((-?[\.\w\d]+)\s*\-\s*(-?[\.\w\d]+))'
  138. mulRe = '((-?[\.\w\d]+)\s*\*\s*(-?[\.\w\d]+))'
  139. divRe = '((-?[\.\w\d]+)\s*\/\s*(-?[\.\w\d]+))'
  140. modRe = '((-?[\.\w\d]+)\s*\%\s*(-?[\.\w\d]+))'
  141. indRe = '(([\.\w\d]+)\[([-*\.\w\d]+)\])'
  142. varRe = '(([\[\s\(])\(([\.\w\d]+)\))'
  143.  
  144. m = re.findall(r'('+addRe+'|'+delRe+'|'+mulRe+'|'+divRe+'|'+modRe+'|'+indRe+'|'+varRe+')', line) # find all matching sub-patterns
  145.  
  146.  
  147. while len(m) > 0 : # if any matching items
  148. #print(line)
  149. var, val, text = "", "", ""
  150. for match in m: # for each submatch, extract the condition, the var and the val
  151. if len(match[1]) > 0: # if first kind of condition
  152. text = match[1]
  153. var = match[2]
  154. val = match[3]
  155. out.write("I.myAdd( I.var" + str(var_count) + "," + var + "," + val +");\n")
  156. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own function
  157. var_count += 1
  158. elif len(match[4]) > 0: # if second kind of condition
  159. text = match[4]
  160. var = match[5]
  161. val = match[6]
  162. out.write("I.myDel( I.var" + str(var_count) + "," + var + "," + val +");\n")
  163. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own function
  164. var_count += 1
  165. elif len(match[7]) > 0:
  166. text = match[7]
  167. var = match[8]
  168. val = match[9]
  169. out.write("I.myMul( I.var" + str(var_count) + "," + var + "," + val +");\n")
  170. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own function
  171. var_count += 1
  172. elif len(match[10]) > 0:
  173. text = match[10]
  174. var = match[11]
  175. val = match[12]
  176. out.write("I.myDiv( I.var" + str(var_count) + "," + var + "," + val +");\n")
  177. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own function
  178. var_count += 1
  179. elif len(match[13]) > 0:
  180. text = match[13]
  181. var = match[14]
  182. val = match[15]
  183. out.write("I.myMod( I.var" + str(var_count) + "," + var + "," + val +");\n")
  184. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own function
  185. var_count += 1
  186. elif len(match[16]) > 0:
  187. text = match[16]
  188. var = match[17]
  189. val = match[18]
  190. #print(types)
  191. if var in types.keys() and (types[var] == "String" or types[var] == "String[]"):
  192. out.write("I.myInd( I.str" + str(str_count) + "," + var + "," + val +");\n")
  193. line = line.replace(text, "I.str" + str(str_count), 1) # replace matched code with own
  194. str_count += 1
  195. elif var in types.keys() and types[var] == "boolean[]":
  196. out.write("I.myInd( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  197. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own
  198. bool_count += 1
  199. else:
  200. out.write("I.myInd( I.var" + str(var_count) + "," + var + "," + val +");\n")
  201. line = line.replace(text, "I.var" + str(var_count), 1) # replace matched code with own
  202. var_count += 1
  203. elif len(match[19]) > 0:
  204. text = match[19]
  205. var = match[20]
  206. val = match[21]
  207. line = line.replace(text, var + val, 1) # replace matched code with own function
  208. #print(line)
  209. m = re.findall(r'('+addRe+'|'+delRe+'|'+mulRe+'|'+divRe+'|'+modRe+'|'+indRe+'|'+varRe+')', line) # find all matching
  210.  
  211. equalsRe = '(([\.\w\d]+)\.equals\(("?[-*\.\w\d]+"?)\))' # for a354505667.equals("e"
  212. isisRe = '(([-*\.\w\d]+)\s*==\s*([-*\.\w\d]+))' # for a1542761177 == 2
  213. leRe = '(([-*\.\w\d]+)\s*<\s*([-*\.\w\d]+))' # for a1542761177 == 2
  214. geRe = '(([-*\.\w\d]+)\s*>\s*([-*\.\w\d]+))' # for a1542761177 == 2
  215. leqRe = '(([-*\.\w\d]+)\s*<=\s*([-*\.\w\d]+))' # for a1542761177 == 2
  216. geqRe = '(([-*\.\w\d]+)\s*>=\s*([-*\.\w\d]+))' # for a1542761177 == 2
  217. andRe = '(([\.\w\d]+)\s*\&\&\s*([\.\w\d]+))' # for a1542761177 == 2
  218. orRe = '(([\.\w\d]+)\s*\|\|\s*([\.\w\d]+))' # for a1542761177 == 2
  219. notRe = '(!([\.\w\d]+))' # for a1542761177 == 2
  220. boolRe = '(([\!\[\s\(])\(([\.\w\d]+)\))'
  221. m = re.findall(r'('+equalsRe+'|'+isisRe+'|'+leRe+'|'+geRe+'|'+leqRe+'|'+geqRe+')', line) # find all matching sub-patterns
  222.  
  223.  
  224. while len(m) > 0 : # if any matching items
  225. #print(line)
  226. var, val, text = "", "", ""
  227. for match in m: # for each submatch, extract the condition, the var and the val
  228. if len(match[1]) > 0: # if first kind of condition
  229. text = match[1]
  230. var = match[2]
  231. val = match[3]
  232. out.write("I.myEquals( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  233. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  234. elif len(match[4]) > 0: # if second kind of condition
  235. text = match[4]
  236. var = match[5]
  237. val = match[6]
  238. out.write("I.myEquals( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  239. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  240. elif len(match[7]) > 0: # if second kind of condition
  241. text = match[7]
  242. var = match[8]
  243. val = match[9]
  244. out.write("I.myLess( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  245. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  246. elif len(match[10]) > 0: # if second kind of condition
  247. text = match[10]
  248. var = match[11]
  249. val = match[12]
  250. out.write("I.myGreater( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  251. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  252. elif len(match[13]) > 0: # if second kind of condition
  253. text = match[13]
  254. var = match[14]
  255. val = match[15]
  256. out.write("I.myLessEqual( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  257. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  258. elif len(match[16]) > 0: # if second kind of condition
  259. text = match[16]
  260. var = match[17]
  261. val = match[18]
  262. out.write("I.myGreaterEqual( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  263. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  264. bool_count += 1
  265. m = re.findall(r'('+equalsRe+'|'+isisRe+'|'+leRe+'|'+geRe+'|'+leqRe+'|'+geqRe+')', line) # find all matching sub-patterns
  266.  
  267. m = re.findall(r'('+andRe+'|'+orRe+'|'+notRe+'|'+boolRe+')', line) # find all matching sub-patterns
  268.  
  269. while len(m) > 0 : # if any matching items
  270. #print(line)
  271. var, val, text = "", "", ""
  272. for match in m: # for each submatch, extract the condition, the var and the val
  273. if len(match[1]) > 0: # if second kind of condition
  274. text = match[1]
  275. var = match[2]
  276. val = match[3]
  277. out.write("I.myAnd( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  278. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  279. elif len(match[4]) > 0: # if second kind of condition
  280. text = match[4]
  281. var = match[5]
  282. val = match[6]
  283. out.write("I.myOr( I.bool" + str(bool_count) + "," + var + "," + val +");\n")
  284. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  285. elif len(match[7]) > 0: # if second kind of condition
  286. text = match[7]
  287. var = match[8]
  288. out.write("I.myNot( I.bool" + str(bool_count) + "," + var + ");\n")
  289. line = line.replace(text, "I.bool" + str(bool_count), 1) # replace matched code with own #print(match[2], match[3])
  290. elif len(match[9]) > 0:
  291. text = match[9]
  292. var = match[10]
  293. val = match[11]
  294. line = line.replace(text, var + val, 1) # replace matched code with own function
  295. bool_count -=1
  296. bool_count += 1
  297. m = re.findall(r'('+andRe+'|'+orRe+'|'+notRe+'|'+boolRe+')', line) # find all matching sub-patterns
  298. #print(line)
  299. assignRe = '(([\.\w\d]+)\s*=\s*(\"?[-*\.\w\d]+\"?)\s*;)' # for a354505667.equals("e"
  300. printRe = '((System.out.println))' # for a354505667.equals("e"
  301. ifRe = '(if\(([\.\w\d]+)\))' # for a354505667.equals("e"
  302. m = re.findall(r'('+assignRe+'|'+printRe+'|'+ifRe+')', line) # find all matching sub-patterns
  303.  
  304. while len(m) > 0 : # if any matching items
  305. #print(line)
  306. var, val, text = "", "", ""
  307. for match in m: # for each submatch, extract the condition, the var and the val
  308. if len(match[1]) > 0: # if first kind of condition
  309. text = match[1]
  310. var = match[2]
  311. val = match[3]
  312. line = line.replace(text, var + " = I.myAssign(" + val + ");", 1)
  313. if len(match[4]) > 0: # if first kind of condition
  314. text = match[4]
  315. var = match[5]
  316. line = line.replace(text, "I.myPrint", 1)
  317. if len(match[6]) > 0: # if first kind of condition
  318. text = match[6]
  319. var = match[7]
  320. line = line.replace(text, "if(I.myIf(" + var + "))", 1)
  321. m = re.findall(r'('+assignRe+'|'+printRe+'|'+ifRe+')', line) # find all matching sub-patterns
  322.  
  323.  
  324. mainRe = '(\s(Problem[\d]+))' # for a354505667.equals("e"
  325. m = re.findall(r'('+mainRe+')', line) # find all matching sub-patterns
  326. if len(m) > 0 : # if any matching items
  327. #print(line)
  328. var, val, text = "", "", ""
  329. for match in m: # for each submatch, extract the condition, the var and the val
  330. if len(match[1]) > 0: # if first kind of condition
  331. text = match[1]
  332. var = match[2]
  333. line = line.replace(text, " inst"+var, 1)
  334.  
  335. readRe = '((stdin.readLine\(\)))' # for a354505667.equals("e"
  336. m = re.findall(r'('+readRe+')', line) # find all matching sub-patterns
  337. if len(m) > 0 : # if any matching items
  338. #print(line)
  339. var, val, text = "", "", ""
  340. for match in m: # for each submatch, extract the condition, the var and the val
  341. if len(match[1]) > 0: # if first kind of condition
  342. text = match[1]
  343. var = match[2]
  344. line = line.replace(text, "new MyString(" + var + ", true)", 1)
  345.  
  346. out.write(line) # write updated code to file
  347.  
  348. reset_in = open('inst'+sys.argv[1], 'r')
  349.  
  350. out.write("public void reset(){\n")
  351. out.write("System.out.println(\"reset\");")
  352. for line in reset_in.readlines():
  353. if line.find("public MyInt") != -1:
  354. if line.find("{") != -1:
  355. out.write(line.split('=',1)[0].split(' ',2)[2])
  356. out.write(" = new MyInt[] ")
  357. out.write(line.split('=',1)[1])
  358. else:
  359. out.write(line.split(' ',2)[2])
  360. if line.find("public MyBool") != -1:
  361. if line.find("{") != -1:
  362. out.write(line.split('=',1)[0].split(' ',2)[2])
  363. out.write(" = new MyBool[] ")
  364. out.write(line.split('=',1)[1])
  365. else:
  366. out.write(line.split(' ',2)[2])
  367. if line.find("public MyString") != -1:
  368. if line.find("{") != -1:
  369. out.write(line.split('=',1)[0].split(' ',2)[2])
  370. out.write(" = new MyString[] ")
  371. out.write(line.split('=',1)[1])
  372. else:
  373. out.write(line.split(' ',2)[2])
  374. out.write("}\n")
  375. out.write("\n")
  376.  
  377.  
  378. out.write("}\n")
  379.  
  380. out.write("class Fuzzer {\n")
  381. out.write("public static MyString[] fuzz(MyString[] inputs){\n")
  382. out.write("Random rand = new Random();\n")
  383. out.write("int length = rand.nextInt(50) + 10;\n");
  384. out.write("MyString[] result = new MyString[length];\n");
  385. out.write("for(int i = 0; i < length; i++){\n");
  386. out.write("int index = rand.nextInt(inputs.length);\n");
  387. out.write("result[i] = new MyString(inputs[index].val, true);\n")
  388. out.write("}\n")
  389. out.write("return result;\n")
  390. out.write("}\n")
  391. out.write("}\n")
  392.  
  393.  
  394. out.write("class MyInt {\n")
  395. out.write("public int val = 0;\n")
  396. out.write("public MyInt(int v){ this.val = v; }")
  397. out.write("}\n")
  398.  
  399. out.write("class MyBool {\n")
  400. out.write("public boolean val = false;\n")
  401. out.write("public MyBool(boolean v){ this.val = v; }")
  402. out.write("}\n")
  403.  
  404. out.write("class MyString {\n")
  405. out.write("public String val = \"\";")
  406. out.write("public boolean flow = false;")
  407. out.write("public MyString(String v){ this.val = v; }")
  408. out.write("public MyString(String v, boolean b){ this.val = v; this.flow = b; }")
  409. out.write("}\n")
  410.  
  411. out.write("class I {\n")
  412. out.write("\n")
  413. for i in range(1,50):
  414. out.write("public static MyInt var" + str(i) + " = new MyInt(0);\n")
  415. out.write("\n")
  416. for i in range(1,50):
  417. out.write("public static MyBool bool" + str(i) + " = new MyBool(false);\n")
  418. for i in range(1,50):
  419. out.write("public static MyString str" + str(i) + " = new MyString(\"\");\n")
  420. out.write("\n")
  421.  
  422. out.write("public static void myAdd(MyInt a, MyInt b, MyInt c){ a.val = b.val+c.val; }\n")
  423. out.write("public static void myDel(MyInt a, MyInt b, MyInt c){ a.val = b.val-c.val; }\n")
  424. out.write("public static void myMul(MyInt a, MyInt b, MyInt c){ a.val = b.val*c.val; }\n")
  425. out.write("public static void myDiv(MyInt a, MyInt b, MyInt c){ a.val = b.val/c.val; }\n")
  426. out.write("public static void myMod(MyInt a, MyInt b, MyInt c){ a.val = b.val%c.val; }\n")
  427. out.write("public static void myInd(MyInt a, MyInt[] b, MyInt c){ a.val = b[c.val].val; }\n")
  428. out.write("public static void myInd(MyString a, MyString[] b, MyInt c){ a.val = b[c.val].val; }\n")
  429.  
  430. out.write("public static void myEquals(MyBool a, MyBool b, MyBool c){ a.val = (b.val == c.val); }\n")
  431. out.write("public static void myEquals(MyBool a, MyInt b, MyInt c){ a.val = (b.val == c.val); }\n")
  432. out.write("public static void myEquals(MyBool a, MyString b, MyString c){ a.val = (b.val.equals(c.val)); }\n")
  433.  
  434. out.write("public static void myLess(MyBool a, MyInt b, MyInt c){ a.val = (b.val < c.val); }\n")
  435. out.write("public static void myGreater(MyBool a, MyInt b, MyInt c){ a.val = (b.val > c.val); }\n")
  436. out.write("public static void myLessEqual(MyBool a, MyInt b, MyInt c){ a.val = (b.val <= c.val); }\n")
  437. out.write("public static void myGreaterEqual(MyBool a, MyInt b, MyInt c){ a.val = (b.val >= c.val); }\n")
  438.  
  439. out.write("public static MyBool myAssign(MyBool b){ MyBool a = new MyBool(b.val); return a; }\n")
  440. out.write("public static MyInt myAssign(MyInt b){ MyInt a = new MyInt(b.val); return a; }\n")
  441. out.write("public static MyInt[] myAssign(MyInt[] b){ MyInt a[] = new MyInt[b.length]; for(int i = 0; i < b.length; i++) a[i] = new MyInt(b[i].val); return a; }\n")
  442. out.write("public static MyString myAssign(MyString b){ MyString a = new MyString(b.val); return a; }\n")
  443.  
  444. out.write("public static void myAnd(MyBool a, MyBool b, MyBool c){ a.val = (b.val && c.val); }\n")
  445. out.write("public static void myOr(MyBool a, MyBool b, MyBool c){ a.val = (b.val || c.val); }\n")
  446. out.write("public static void myNot(MyBool a, MyBool b){ a.val = (!b.val); }\n")
  447.  
  448. out.write("public static void myPrint(MyString a){ System.out.println(\"\\n\"+a.val); }\n")
  449. out.write("public static void myPrint(String a){ myPrint(new MyString(a)); }\n")
  450. out.write("public static boolean myIf(MyBool a){ System.out.print(\"b\" + a.val + \" \"); return a.val; }\n")
  451.  
  452. out.write("public static void myAdd(MyInt a, MyInt b, int c){ myAdd(a,b,new MyInt(c)); }\n")
  453. out.write("public static void myAdd(MyInt a, int b, MyInt c){ myAdd(a,new MyInt(b),c); }\n")
  454. out.write("public static void myAdd(MyInt a, int b, int c){ myAdd(a,new MyInt(b),new MyInt(c)); }\n")
  455. out.write("public static void myDel(MyInt a, MyInt b, int c){ myDel(a,b,new MyInt(c)); }\n")
  456. out.write("public static void myDel(MyInt a, int b, MyInt c){ myDel(a,new MyInt(b),c); }\n")
  457. out.write("public static void myDel(MyInt a, int b, int c){ myDel(a,new MyInt(b),new MyInt(c)); }\n")
  458. out.write("public static void myMul(MyInt a, MyInt b, int c){ myMul(a,b,new MyInt(c)); }\n")
  459. out.write("public static void myMul(MyInt a, int b, MyInt c){ myMul(a,new MyInt(b),c); }\n")
  460. out.write("public static void myMul(MyInt a, int b, int c){ myMul(a,new MyInt(b),new MyInt(c)); }\n")
  461. out.write("public static void myDiv(MyInt a, MyInt b, int c){ myDiv(a,b,new MyInt(c)); }\n")
  462. out.write("public static void myDiv(MyInt a, int b, MyInt c){ myDiv(a,new MyInt(b),c); }\n")
  463. out.write("public static void myDiv(MyInt a, int b, int c){ myDiv(a,new MyInt(b),new MyInt(c)); }\n")
  464. out.write("public static void myMod(MyInt a, MyInt b, int c){ myMod(a,b,new MyInt(c)); }\n")
  465. out.write("public static void myMod(MyInt a, int b, MyInt c){ myMod(a,new MyInt(b),c); }\n")
  466. out.write("public static void myMod(MyInt a, int b, int c){ myMod(a,new MyInt(b),new MyInt(c)); }\n")
  467. out.write("public static void myInd(MyInt a, MyInt[] b, int c){ myInd(a,b,new MyInt(c)); }\n")
  468. out.write("public static void myInd(MyInt a, int[] b, int c){ myInd(a,I.myAssign(b),new MyInt(c)); }\n")
  469. out.write("public static void myInd(MyString a, MyString[] b, int c){ myInd(a,b,new MyInt(c)); }\n")
  470.  
  471. out.write("public static void myEquals(MyBool a, MyBool b, boolean c){ myEquals(a, b, new MyBool(c)); }\n")
  472. out.write("public static void myEquals(MyBool a, MyInt b, int c){ myEquals(a, b, new MyInt(c)); }\n")
  473. out.write("public static void myEquals(MyBool a, MyString b, String c){ myEquals(a, b, new MyString(c)); }\n")
  474. out.write("public static void myEquals(MyBool a, boolean b, MyBool c){ myEquals(a, new MyBool(b), c); }\n")
  475. out.write("public static void myEquals(MyBool a, int b, MyInt c){ myEquals(a, new MyInt(b), c); }\n")
  476. out.write("public static void myEquals(MyBool a, String b, MyString c){ myEquals(a, new MyString(b), c); }\n")
  477. out.write("public static void myEquals(MyBool a, boolean b, boolean c){ myEquals(a, new MyBool(b), new MyBool(c)); }\n")
  478. out.write("public static void myEquals(MyBool a, int b, int c){ myEquals(a, new MyInt(b), new MyInt(c)); }\n")
  479. out.write("public static void myEquals(MyBool a, String b, String c){ myEquals(a, new MyString(b), new MyString(c)); }\n")
  480.  
  481. out.write("public static void myLess(MyBool a, MyInt b, int c){ myLess(a, b, new MyInt(c)); }\n")
  482. out.write("public static void myGreater(MyBool a, MyInt b, int c){ myGreater(a, b, new MyInt(c)); }\n")
  483. out.write("public static void myLessEqual(MyBool a, MyInt b, int c){ myLessEqual(a, b, new MyInt(c)); }\n")
  484. out.write("public static void myGreaterEqual(MyBool a, MyInt b, int c){ myGreaterEqual(a, b, new MyInt(c)); }\n")
  485. out.write("public static void myLess(MyBool a, int b, MyInt c){ myLess(a, new MyInt(b), c); }\n")
  486. out.write("public static void myGreater(MyBool a, int b, MyInt c){ myGreater(a, new MyInt(b), c); }\n")
  487. out.write("public static void myLessEqual(MyBool a, int b, MyInt c){ myLessEqual(a, new MyInt(b), c); }\n")
  488. out.write("public static void myGreaterEqual(MyBool a, int b, MyInt c){ myGreaterEqual(a, new MyInt(b), c); }\n")
  489. out.write("public static void myLess(MyBool a, int b, int c){ myLess(a, new MyInt(b), new MyInt(c)); }\n")
  490. out.write("public static void myGreater(MyBool a, int b, int c){ myGreater(a, new MyInt(b), new MyInt(c)); }\n")
  491. out.write("public static void myLessEqual(MyBool a, int b, int c){ myLessEqual(a, new MyInt(b), new MyInt(c)); }\n")
  492. out.write("public static void myGreaterEqual(MyBool a, int b, int c){ myGreaterEqual(a, new MyInt(b), new MyInt(c)); }\n")
  493.  
  494. out.write("public static MyBool myAssign(boolean b){ return myAssign(new MyBool(b)); }\n")
  495. out.write("public static MyInt myAssign(int b){ return myAssign(new MyInt(b)); }\n")
  496. out.write("public static MyInt[] myAssign(int[] b){ MyInt a[] = new MyInt[b.length]; for(int i = 0; i < b.length; i++) a[i] = new MyInt(b[i]); return myAssign(a); }\n")
  497. out.write("public static MyString myAssign(String b){ return myAssign(new MyString(b)); }\n")
  498.  
  499. out.write("}\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement