jack-compiler/parser/parser.c

24 lines
424 B
C
Raw Normal View History

2020-12-14 14:12:20 -05:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "parser.h"
2020-12-22 11:18:54 -05:00
#include "parser-structure.h"
2020-12-14 14:12:20 -05:00
2021-01-03 14:08:54 -05:00
PARSER* mkparser(TOKEN* t, char* file) {
2020-12-14 14:12:20 -05:00
PARSER* parser = (PARSER*)malloc(sizeof(PARSER));
2021-01-03 14:08:54 -05:00
parser->tokens = t;
parser->current = t;
2020-12-14 14:12:20 -05:00
parser->file = file;
2021-01-03 14:08:54 -05:00
return parser;
}
CLASS* parse(PARSER* p) {
return parseclass(p);
}
void freeparser(PARSER* p) {
freetokens(p->tokens);
free(p);
2020-12-14 14:12:20 -05:00
}