> Absolutely! I've simplified some source code and attached two files testlex.c > and testpar.c. > I'm not sure if the mailing list strips out attachments ....
I guess it does strip attachments. For the benefits of the mailing list, I'll inline the code (assuming gmail doesn't mess it up more than it is already)... ----------------- testlex.c ----------------- /* Test Lexer for Lemon Parser */ #include <stdio.h> #include <stdlib.h> #include "testpar.h" extern void *ParseAlloc(void *(*mallocProc)(size_t)); extern void Parse(void *, int, void *); extern void ParseFree(void *, void (*freeProc)(void *)); extern void ParseTrace(FILE *stream, char *zPrefix); int main() { void *pParser; pParser = ParseAlloc(malloc); if (!pParser) { printf("out of memory\n"); exit(1); } ParseTrace(stderr, "Debug: "); Parse(pParser, LPC_CMDNAME, 0); Parse(pParser, LPC_INTEGER, 0); Parse(pParser, LPC_TEXT, 0); Parse(pParser, LPC_EOL, 0); Parse(pParser, LPC_CMDNAME, 0); Parse(pParser, LPC_INTEGER, 0); Parse(pParser, LPC_TEXT, 0); Parse(pParser, LPC_EOL, 0); Parse(pParser, 0, 0); ParseFree(pParser, free); return 0; } ----------------- testpar.y ----------------- %include { #include <assert.h> } %token_prefix LPC_ %parse_accept { printf("Parsing complete\n"); } %parse_failure { printf("Giving up...\n"); } %syntax_error { printf("Error in input syntax\n"); } %start_symbol database /* Start symbol */ database ::= entrylist. { printf("Constructed the root\n"); } entrylist ::= command. entrylist ::= entrylist command. command ::= CMDNAME cmdargs EOL. { printf("Reducing to command state\n"); } cmdargs ::= . cmdargs ::= cmdargs cmdarg. cmdarg ::= INTEGER. cmdarg ::= TEXT. ----------------- end ----------------- _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users