A minimalistic programming language written in C89.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
617 B

#include "ink.h"
#include <stdio.h>
int main(int argc, char** argv) {
char read_buffer[2048];
struct context* ctx = ink_make_default_context();
char** end_argv = argv + argc;
for(argv+=1; argv != end_argv; argv++) {
FILE* file = fopen(*argv, "r");
size_t cnt = fread(read_buffer, 1, 2047, file);
if(cnt == 0) {
}
read_buffer[cnt] = 0;
ink_compile(ctx, read_buffer);
if(ctx->panic) {
fprintf(stderr, "Panicked !! -> %d\n", ctx->panic);
}
fclose(file);
}
while(ink_can_run(ctx)) {
ink_step_everyone(ctx);
}
printf("\nExecuted in %u steps\n", ctx->steps);
return ctx->panic;
}