aboutsummaryrefslogtreecommitdiff
path: root/src/bfc.c
blob: 2e369cff9c275c7e9426e2dc97c44b76866eac89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "all.h"
#include "str.h"
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  str input = {0};
  str_append_fread(&input, stdin);

  lexer_t lexer = lex_init(&input);
  lex_run(&lexer);

  parser_t p = parser_init(&lexer);

  ast_node_t *ast = parse_program(&p);

  // lex_free(&lexer);
  // parser_free(&p);

  str c_code = gen_code(ast);

  ast_free(ast);

  printf("%s", c_code.data);

  free_str(&input);
  return 0;
}