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.

38 lines
714 B

#include "include/ink.h"
#include <stdio.h>
#include <string.h>
#include <malloc.h>
int nop_putchar(int n) {
return n;
}
int main(int _1, char** _2) {
char read_buffer[2048];
struct context* ctx = ink_make_default_context();
ctx->putchar = nop_putchar;
char* argv_d[3];
argv_d[0] = "test/bench01.nk";
argv_d[1] = "test/bench02.nk";
argv_d[2] = "test/bench03.nk";
char** it = argv_d;
char** end_argv = it + 3;
for(; it != end_argv; it++) {
FILE* file = fopen(*it, "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) {
perror("Panicked !!");
}
fclose(file);
}
return ctx->panic;
}