b132bbd3813f6e97029103abe845ace2305138f7
7 static void loop(PSI_Lexer
*L
, void *P
)
13 PSI_ParserTrace(stdout
, "> ");
16 while (-1 != (t
= PSI_LexerScan(L
))) {
17 if (!(T
= PSI_TokenAlloc(L
, t
))) {
22 printf("# Token: <%s>(%d)\n", T
->text
, t
);
25 PSI_Parser(P
, t
, T
, L
);
27 PSI_Parser(P
, 0, T
, L
);
30 int main(int argc
, char *argv
[])
36 TRACE
= !!getenv("TRACE");
38 if (!PSI_LexerInit(&L
, argv
[1])) {
39 perror("Failed to init lexer");
42 if (!PSI_ParserInit(&P
)) {
43 perror("Failer to init parser");
47 while (PSI_ParserParse(&p
, &L
));
49 PSI_ParserFree(P
, free
);
51 if (!PSI_ValidatorInit(&V
, &L
)) {
52 perror("Failed to init validator");
58 if (PSI_ValidatorValidate(&V
)) {
59 printf("Whoa! VALID.\n");
61 PSI_ValidatorDtor(&V
);