implemented the lexer
This commit is contained in:
commit
f1675bca76
13 changed files with 1303 additions and 0 deletions
24
cc.c
Normal file
24
cc.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "utils.h"
|
||||
#include "lexer.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *fp = fopen("test.c", "r");
|
||||
usize size = 0;
|
||||
fseek(fp, 0, SEEK_END);
|
||||
size = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
char *src = malloc(size+1);
|
||||
fread(src, size, 1, fp);
|
||||
fclose(fp);
|
||||
src[size] = '\0';
|
||||
|
||||
arena a = arena_init(0x1000 * 0x1000 * 64);
|
||||
lexer *l = lexer_init(src, size, &a);
|
||||
|
||||
arena_deinit(a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue