You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would love it if there was an option on BNFC to parse into either a std::shared_ptr/std::unique_ptr or to stack allocate classes because it's been a chore to track down everything that's been parsed and properly delete it.
A first step could be to write up an example how the product should look like (e.g. by modifying some BNFC-generated C++ output). I cannot help here much since I am not an active C++ programmer.
Once the design is complete, it should not be hard to get it into BNFC. I can help with the Haskell part, if needed.
I created a PR.
If it's no problem, I would like to try to modify Absyn.C/H to use smart-pointer.
bnfc generating C++ code using inheritance, so this maybe a bit difficult. However, if it's successfully done, no need to use delete() function.
@andreasabel I created second pull-request at #410
I gave up using std::unique_ptr, then use std::shared_ptr. Because it's more applicable for bnfc usecase.
Please take a look it.
EDIT:
I would like to ask about what unit tests should be added in the bnfc code-base, because I'm afraid of breaking bnfc current behavior. We all don't like regression bug.
@andreasabel
Hi, long time no see.
Is there a chance that my pull request (#410) will be merged?
If regression is a problem, I can divide the pull request into small ones or make a pull request to be test functions only.
If additional function is not necessary, or it can not be maintained. Anyway, I wish to close or merge that.
Activity
andreasabel commentedon Apr 29, 2020
I am not proficient enough in C++ to attempt an implementation, but PRs are welcome!
s5bug commentedon Apr 29, 2020
I don't know that much about the tools BNFC uses to generate C++ code, but I'll do my best.
andreasabel commentedon Oct 8, 2020
BNFC does not use a lot of tools; it simply prints concrete syntax, maybe with the help of the
Text.Prettypretty printing library.bbyalcinkaya commentedon Dec 16, 2020
Makefiles for C++ backend have
--ansiflag and C++98 does not supportshared_ptr/unique_ptr. Is it safe to switch to C++11?andreasabel commentedon Dec 28, 2020
Well, if there is an option
then this option would output a
Makefilewith the appropriate flags (like picking the necessary C++ version).So, short answer: yes.
hangingman commentedon Aug 27, 2021
I would like to do this issue if I have time...
Currently BNFC generates C++ codes like
delete someInstanceinstead ofstd::unique_ptrandreasabel commentedon Aug 27, 2021
Great!
A first step could be to write up an example how the product should look like (e.g. by modifying some BNFC-generated C++ output). I cannot help here much since I am not an active C++ programmer.
Once the design is complete, it should not be hard to get it into BNFC. I can help with the Haskell part, if needed.
hangingman commentedon Oct 9, 2021
I created a PR.
If it's no problem, I would like to try to modify Absyn.C/H to use smart-pointer.
bnfc generating C++ code using inheritance, so this maybe a bit difficult. However, if it's successfully done, no need to use delete() function.
Clone pattern for std::shared_ptr in C++
following part will be changed.
Re #293: add new option --ansi to C++ backends (does nothing yet)
hangingman commentedon Jan 29, 2022
@andreasabel I created second pull-request at #410
I gave up using
std::unique_ptr, then usestd::shared_ptr. Because it's more applicable for bnfc usecase.Please take a look it.
EDIT:
I would like to ask about what unit tests should be added in the bnfc code-base, because I'm afraid of breaking bnfc current behavior. We all don't like regression bug.
Revert "Re #293: add new option --ansi to C++ backends (does nothing …
Revert "Re #293: add new option --ansi to C++ backends (does nothing …
Revert "Re #293: add new option --ansi to C++ backends (does nothing …
hangingman commentedon May 6, 2022
@andreasabel Hi, I updated PR again.
It took much time, sorry.
#410
hangingman commentedon Jun 19, 2023
@andreasabel
Hi, long time no see.
Is there a chance that my pull request (#410) will be merged?
If regression is a problem, I can divide the pull request into small ones or make a pull request to be test functions only.
If additional function is not necessary, or it can not be maintained. Anyway, I wish to close or merge that.