Compare commits
No commits in common. "0c4c6e7ad512604deb68115eda9ea016da026329" and "4d344db1481becd873bf76e25b93acb0c02bca31" have entirely different histories.
0c4c6e7ad5
...
4d344db148
|
@ -1,33 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd /tmp/$1
|
cd /tmp/$1
|
||||||
sedarg="\
|
timeout -s KILL 3 xargs -a args.args -d '\n' brainfuck code.code < stdin.stdin
|
||||||
s/+/P/g;\
|
|
||||||
s/-/M/g;\
|
|
||||||
s/>/++p;/g;\
|
|
||||||
s/</--p;/g;\
|
|
||||||
s/P/++*p;/g;\
|
|
||||||
s/M/--*p;/g;\
|
|
||||||
s/\\./putchar(*p);/g;\
|
|
||||||
s/,/*p=(c=getchar())==EOF?0:c;/g;\
|
|
||||||
s/\\[/while(*p){/g;\
|
|
||||||
s/]/}/g\
|
|
||||||
"
|
|
||||||
|
|
||||||
# compilation
|
|
||||||
MEMSIZE=15
|
|
||||||
cat <<EOF > code.c
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
char mem[1<<$MEMSIZE];
|
|
||||||
char *p = mem + (1<<$((MEMSIZE - 1)));
|
|
||||||
int c;
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
$(timeout -s KILL 3 sed 's/[^][<>.,+-]//g' code.code | timeout -s KILL 3 sed $sedarg)
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
timeout -s KILL 3 gcc -std=c11 -o binary code.c
|
|
||||||
|
|
||||||
# execution
|
|
||||||
timeout -s KILL 3 ./binary < args.args < stdin.stdin
|
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
cd /tmp/$1
|
cd /tmp/$1
|
||||||
cp code.code main.zig
|
cp code.code main.zig
|
||||||
timeout -s KILL 10 zig build-exe main.zig && \
|
timeout -s KILL 10 zig build-exe main.zig
|
||||||
timeout -s KILL 3 xargs -a args.args -d '\n' ./main
|
timeout -s KILL 3 xargs -a args.args -d '\n' ./main
|
||||||
|
|
Loading…
Reference in New Issue