]> begriffs open source - sa-parse/blob - src/csv_driver.c
Simplify CSV parser to match one in my blog
[sa-parse] / src / csv_driver.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #include "csv.tab.h"
5
6 extern int yyparse(void);
7 extern FILE *yyin;
8
9 int main(void)
10 {
11         /* Use stdin for input */
12         yyin = stdin;
13         
14         printf("CSV Parser - Enter CSV data (Ctrl+D to end):\n");
15         
16         int result = yyparse();
17         
18         if (result == 0) {
19                 printf("Parsing completed successfully.\n");
20         } else {
21                 printf("Parsing failed with code %d.\n", result);
22         }
23         
24         return result;
25 }