c4664be36b45d426523d69d9487a0bfb0f0520ea
9 static void loop(PSI_Lexer
*L
, void *P
)
15 PSI_ParserTrace(stdout
, "> ");
18 while (-1 != (t
= PSI_LexerScan(L
))) {
19 if (!(T
= PSI_TokenAlloc(L
, t
))) {
24 printf("# Token: <%s>(%d)\n", T
->text
, t
);
27 PSI_Parser(P
, t
, T
, L
);
29 PSI_Parser(P
, 0, T
, L
);
32 int main(int argc
, char *argv
[])
36 void *P
= PSI_ParserAlloc(malloc
);
38 TRACE
= !!getenv("TRACE");
40 if (!PSI_LexerInit(&L
, argv
[1])) {
41 perror("Failed to init lexer");
47 PSI_ParserFree(P
, free
);
49 if (!PSI_ValidatorInit(&V
, &L
)) {
50 perror("Failed to init validator");
56 if (PSI_ValidatorValidate(&V
)) {
57 printf("Whoa! VALID.\n");
59 PSI_ValidatorDtor(&V
);