A minimalistic programming language written in C89.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
672 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);
}
ink_gc(ctx);
printf("\nExecuted in %u steps\nCollected %u times\n", ctx->steps, ctx->collections);
return ctx->panic;
}