- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
import os
import sys
code = open(sys.argv[1])
outfilename = sys.argv[2]
outc = open(outfilename + ".cpp", "w")
commands = code.read().split("\n")
outc.write("#include <stdio.h>\n#include <string.h>\nint main(){\n")
outc.write(
"""\tint i = 0;
\tchar arr[30000];
\tmemset(arr, 0, sizeof(arr));
""")
outc.write("//USER COMMANDS\n")
a = 2
for c in commands:
if c == "gavno":
outc.write("\ti++;\n")
elif c == "blat":
outc.write("\ti--;\n")
elif c == "GAVNO":
outc.write("\tarr[i]++;\n")
elif c == "BLAT":
outc.write("\tarr[i]--;\n")
elif c == "GAVNO BLAT":
outc.write("\tputchar(arr[i]);\n")
elif c == "GAVNO GAVNO":
outc.write("\twhile(arr[i]){\n")
elif c == "BLAT BLAT":
outc.write("}\n")
elif c == "BLAT GAVNO":
outc.write("\tarr[i]=getchar();\n")
outc.write("}")
outc.close()
os.system("/bin/env gcc -O3 -o "+outfilename+".exe " + outfilename + ".cpp")
Elvenfighter 11.08.2016 13:16 # +13
Где здесь C++, zpix?
pedarok 11.08.2016 16:39 # −24
Xom94ok 11.08.2016 16:53 # +11
1kasper 11.08.2016 20:00 # −23
Сейчас сделают улучшенную версию с чистым кодом и либами.
Elvenfighter 13.08.2016 23:29 # +11
guesto 21.08.2016 02:26 # −6
guest 20.08.2016 11:07 # −12
bagor 20.08.2016 11:28 # −51