-1

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.

Amal
  • 243
  • 1
  • 3
  • 8
  • I'd say you didn't give Dparser a file name in which to write its generated tables. Did you read its usage docs? – Ira Baxter Aug 12 '13 at 10:37
  • Of course I have read the docs. The file name for the tables are automatically chosen (d_parser_mach_gen.g.d_parser.dat, d_parser_mach_gen.g.md5). I found out that the problem with these warnings was because I had errors in my grammar and I had forgot 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. – Amal Aug 12 '13 at 14:54
  • You might add your discovery of the problem as an answer (yes, you can answer your own question) so this question achieves closure. [I have to admit, the causal connection between failing to quote a grammar element and the error message you got, completely escapes me]. – Ira Baxter Aug 12 '13 at 17:33

1 Answers1

1

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 ']'
Amal
  • 243
  • 1
  • 3
  • 8