C target broken in antlr >= 3.5
The C target is entirely broken in antlr >= 3.5. In earlier versions there was a warning which became an error in antlr >= 3.5:
error(24): template error: context [/outputFile /parser] 1:1 could not pass through undefined attribute filterMode
making antlr not producing lexer code.
We seem to see similar with cvc4 and belle-sip. Ultimately leads to errors like:
generated/Smt1Lexer.c:1759:41: error: '_empty' was not declared in this scope
dfa13_T182, dfa13_T143, dfa13_T209, _empty, _empty, _empty, dfa13_T53,
Dear Orion,
I was getting these kinds of errors even before too and fixed them (in my case) by:
@lexer::includes { #define _empty NULL }
Its a pity that the C target is in such a bad shape (and reason why we are moving off from Antlr after 10 years of using it in our developments).
Milos
2015-09-01 4:25 GMT+02:00 Orion Poplawski [email protected]:
We seem to see similar with cvc4 and belle-sip. Ultimately leads to errors like:
generated/Smt1Lexer.c:1759:41: error: '_empty' was not declared in this scope dfa13_T182, dfa13_T143, dfa13_T209, _empty, _empty, _empty, dfa13_T53,
— Reply to this email directly or view it on GitHub https://github.com/antlr/antlr3/issues/175#issuecomment-136554834.
Thanks, that may be helpful for cvc4, bit in the belle-sip case, we can't get around the antlr template error:
error(24): template error: context [/outputFile /parser] 1:1 could not pass through undefined attribute filterMode
I see lots of people reporting that error as a warning. Not sure why it appears as an error for belle-sip.
That is what changed from 3.4 to 3.5: it was a warning, now it is an error. Dne 1. 9. 2015 17:19 napsal uživatel "Orion Poplawski" < [email protected]>:
I see lots of people reporting that error as a warning. Not sure why it appears as an error for belle-sip.
— Reply to this email directly or view it on GitHub https://github.com/antlr/antlr3/issues/175#issuecomment-136757825.
I think this regression shown up between 3.5 releases. Maybe 3.5.1 => 3.5.2. It has something to do with StringTemplate library used internally by Antlr. About year ago I went through C++ target and have fixed these warnings at least for this one. If somebody is willing to fix this, I recommend to go though these commits (it should be easy to port these fixes back into the C target). https://github.com/ibre5041/antlr3/commits/master?page=3. Also this patch significantly improves performance of generated parser (when using predicates): https://github.com/ibre5041/antlr3/commit/e36baba6c96a9ffa034cd6f61321c17d01abf7fc