f8029581734cc2fb2efdf707447a17773d4d6ece
10 static void loop(PSI_Lexer
*L
, void *P
)
16 PSI_ParserTrace(stdout
, "> ");
19 while (-1 != (t
= PSI_LexerScan(L
))) {
20 if (!(T
= PSI_TokenAlloc(L
, t
))) {
25 printf("# Token: <%s>(%d)\n", T
->text
, t
);
28 PSI_Parser(P
, t
, T
, L
);
30 PSI_Parser(P
, 0, T
, L
);
33 int main(int argc
, char *argv
[])
37 void *P
= PSI_ParserAlloc(malloc
);
39 TRACE
= !!getenv("TRACE");
41 if (!PSI_LexerInit(&L
, argv
[1])) {
42 perror("Failed to init lexer");
48 PSI_ParserFree(P
, free
);
50 if (!PSI_ValidatorInit(&V
, &L
)) {
51 perror("Failed to init validator");
57 if (PSI_ValidatorValidate(&V
)) {
58 printf("Whoa! VALID.\n");
60 PSI_ValidatorDtor(&V
);