35 lines
551 B
C
35 lines
551 B
C
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "config.h"
|
|
#include "execute.h"
|
|
#include "stack.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
if (argc < 2)
|
|
{
|
|
fprintf(stderr, "Usage: %s [FILE]\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
Stack *stack = program_init(STACK_SIZE);
|
|
|
|
FILE *file = fopen(argv[1], "r");
|
|
if (!file)
|
|
{
|
|
perror("fopen()");
|
|
return 1;
|
|
}
|
|
|
|
parse_and_process(stack, file);
|
|
|
|
fclose(file);
|
|
|
|
execute(stack, (void *)0, argv[1]);
|
|
|
|
return 0;
|
|
}
|