-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
43 lines (35 loc) · 788 Bytes
/
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
//
// Created by chenzhang on 04/01/2019.
//
#include "Python.h"
#include "grammar.h"
#include "graminit.h"
#include "node.h"
#include "token.h"
#include "parsetok.h"
#include "errcode.h"
#include "main.h"
#include <stdio.h>
void freeme(char* ptr)
{
if (ptr != NULL) {
// printf("Freeing memory... %p\n", (void*)ptr);
free(ptr);
}
}
int main() {
char* s = tokenize("if a:# hahaha\n b = c", 0);
printf("%s\n", s);
freeme(s);
s = tokenize("for a, b in c['x'][2", 1);
printf("%s\n", s);
freeme(s);
s = predict("for a , <unk> in c [ <str> ] [ <num>");
printf("%s\n", s);
freeme(s);
s = predict2("for a, b in c['x'][2");
printf("%s\n", s);
freeme(s);
printf("%d\n", isidentifier("print"));
return 0;
}