-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved C backend and added line number option #238
Conversation
- moved RegToFlex.hs from NoSTL to C module since flex source is in C. - removed broken "#" handling of regex set subtraction. - handles set substraction for special cases (just like Java JFLex) - use yylloc for tracking line and character number
- C++ backends no longer uses the C one
- token pragmas were not following camel case correctly while other code calling them was - removed standards violating _p_ convention
Sorry for missing this PR, and thanks for your work on it.
(Your other questions could be taken later, as they are more about style.) |
I got it to do what I wanted it to, but I am unsure if I am going about things the best way. However, if you want to address the issues in a different way, or only some of them, I understand. Unfortunately, I have moved on from this project at work so I cannot work on any more changes to this. But, I am happy to discuss the issues. |
I think the C backend could use a refactor from someone who understands the code better. If that is unlikely to happen in the near future, my changes may be helpful until then. |
…into pr238 See: #238 Conflicts: source/BNFC.cabal source/src/BNFC/Backend/C.hs source/src/BNFC/Backend/C/CFtoBisonC.hs source/src/BNFC/Backend/C/CFtoCAbs.hs source/src/BNFC/Backend/C/CFtoCSkel.hs source/src/BNFC/Backend/C/RegToFlex.hs source/src/BNFC/Options.hs Changes to be committed: modified: source/BNFC.cabal modified: source/src/BNFC/Backend/C.hs modified: source/src/BNFC/Backend/C/CFtoBisonC.hs modified: source/src/BNFC/Backend/C/CFtoCAbs.hs modified: source/src/BNFC/Backend/C/CFtoCPrinter.hs modified: source/src/BNFC/Backend/C/CFtoCSkel.hs modified: source/src/BNFC/Backend/C/CFtoFlexC.hs renamed: source/src/BNFC/Backend/CPP/NoSTL/RegToFlex.hs -> source/src/BNFC/Backend/C/RegToFlex.hs modified: source/src/BNFC/Backend/CPP/NoSTL/CFtoFlex.hs modified: source/src/BNFC/Options.hs
Summary
yylloc
for robust line and character location tracking. This is used for error handler and to store line and character number on syntax tree, if the option is enabled.char - ...
using the ideas found in the JFlex backend.RegToFlex.h
from NoSTL module to C module since flex generation is in the C module, and all CPP backends reference that one.Questions
yylineno
instead when the RecordPosition options are disabled. This would only be referenced in the yyerror handler. What do you think?CFtoCVisitSkel
andCFtoCVisitSkelSTL
are only for C++, not C. Would it be better to rename them to something likeCFtoCPPVisitSkel
andCFToSTLVisitSkel
?typedef Var_* Var
to be extremely confusing, and I am not alone. Can I change this, or is compatibility important here. I understand if it is.Todo