-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
75 lines (65 loc) · 1.84 KB
/
main.c
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <stdio.h>
#include "lexer/lex.yy.c"
#include "parser/parser.h"
#define inpitfile "main2.go"
void start_lexer() {
FILE *in = fopen(inpitfile, "r");
yyset_in(in);
TokenNode* tokensList = tokensList_create();
yylex();
parser_start(tokensList);
/*
TokenNode *tokens = tokensList->next;
printf("\n");
while(tokens) {
Token el = tokens->token;
switch (el.type) {
case ID:
printf("ID. NAME: %s\n", el.info.varname);
break;
case STRING_LIT:
printf("STRING_LIT. VALUE: %s\n", el.info.value.strvalue);
break;
case CHAR_LIT:
printf("CHAR_LIT. VALUE: %c\n", el.info.value.intfalue);
break;
case FLOAT_LIT:
printf("FLOAT_LIT. VALUE: %f\n", el.info.value.floatvalue);
break;
case INT_LIT:
printf("INT_LIT. VALUE: %d\n", el.info.value.intfalue);
break;
case PRIM_TYPE:
printf("PRIM_TYPE. VALUE: %s\n", el.info.varname);
break;
case FUNC:break;
case VAR:break;
case FOR:break;
case IF:break;
case ELSE:break;
case OPEN:break;
case CLOSE:break;
case BLOPEN:break;
case BLCLOSE:break;
case NEQUAL:break;
case EQUAL:break;
case INIT:break;
case ASSIGN:break;
case NOT:break;
case PLUS:break;
case MINUS:break;
case MUL:break;
case DIV:break;
case DOT:break;
case COMMA:break;
case PACKAGE:break;
}
tokens = tokens->next;
}
*/
fclose(in);
}
int main() {
start_lexer();
return 0;
}