parsingcompiler-constructionparser-generatorglr

DParser- warning: trying to write code to binary file


I have a large grammar written for DParser and using the Python binding. When I first run the parser, and DParser generates its internal tables, I get a number of warnings like these:

warning: trying to write code to binary file
warning: trying to write code to binary file
warning: trying to write code to binary file

Not sure what the cause of source of these warnings are. The only thing I could find was in the DParser source code "write_tables.c":

write_code(FILE *fp, Grammar *g, Rule *r, char *code,
           char *fname, int line, char *pathname) 
{
    char *c;

    if ( !fp ) {
        d_warn("trying to write code to binary file");
        return;
    }
    ...
}

Any hints or ideas would be appreciated.


Solution

  • I found out that the problem with these warnings was because I had errors in my grammar and I had forgotten to add quotes around [ ] in some cases. Like:

     [ example_non_terminal ]
    

    It was taking example_non_terminal as a character set. A number of these were causing the problem. The correct grammar should have been:

     '[' example_non_terminal ']'