I am running following command for generation:
bnfc --cpp -l -m -o src/Stella -p Stella Stella.cf
I get this Test.C file:
...
Stella::Program *parse_tree = NULL;
try {
parse_tree = Stella::pProgram(input);
} catch( Stella::parse_error &e) {
std::cerr << "Parse error on line " << e.getLine() << "\n";
}
...
But it does not throw parse_error when given a faulty input, in fact, it just prints following:
error: 1,1: syntax error at <....>
I found this PR that added parse_error: #288
But the file source/src/BNFC/Backend/CPP/STL/CFtoBisonSTL.hs is absent in 2.9.5 version, I assume BNFC uses somehow the C related stuff to generate the .y file. This is the generated Stella.y file that I get:
...
void yyerror(YYLTYPE *loc, yyscan_t scanner, YYSTYPE *result, const char *msg)
{
fprintf(stderr, "error: %d,%d: %s at %s\n",
loc->first_line, loc->first_column, msg, Stellaget_text(scanner));
}
...
I assume that here should be something like throw Stella::parse_error.
I am running following command for generation:
bnfc --cpp -l -m -o src/Stella -p Stella Stella.cfI get this
Test.Cfile:But it does not throw
parse_errorwhen given a faulty input, in fact, it just prints following:I found this PR that added
parse_error: #288But the file
source/src/BNFC/Backend/CPP/STL/CFtoBisonSTL.hsis absent in 2.9.5 version, I assume BNFC uses somehow the C related stuff to generate the .y file. This is the generatedStella.yfile that I get:I assume that here should be something like
throw Stella::parse_error.