Open hangingman opened 2 years ago
Thanks for the update, @hangingman ! I will have a look soon, but I decided to make 2.9.4 a conservative release, and only then merge new features.
Thanks @hangingman for the PR!
Please make sure the tests still work. You can run the testsuite from the /testing
directory:
/testing$ make
I pushed a commit that puts the C++
tests first.
At the moment, they error if flag -l
is supplied (which adds position information).
Also, the plain --ansi
version fails to compile:
Calc.y:40:33: error: typedef redefinition with different types ('struct yy_buffer_state *' vs
'struct calc__buffer_state *')
typedef struct yy_buffer_state *YY_BUFFER_STATE;
(This is for bnfc -m --cpp --ansi /examples/Calc.cf && make
.)
@andreasabel Thank you !
At the moment, they error if flag -l is supplied (which adds position information).
Got it. I'll look into it.
Also, the plain --ansi version fails to compile:
OK, I will fix it.
Looks like Haskell-CI is currently broken because of
I'll fix a push to master
and then this PR can be rebased onto master
.
@andreasabel Oh, I got it.
I pushed the fix for #416 to master just now.
Sorry broke the stack build by accident, but now both builds should work. (Fixed in #417.)
@andreasabel CI is passed. But, I realized test cases under the testing directory is failing. I'm checking it.
working on this PR https://github.com/hangingman/bnfc/pull/5
@andreasabel Hi, I make it passed all C/C++ system tests. https://github.com/hangingman/bnfc/pull/5#issue-1178753984 I think bnfc code in this branch can generate decent C++ code. Please take a look it.
@andreasabel @VBeatrice Hi, I have already tried this code in my project and it works very well. Could you please tell me when you will be able to merge this pull request? Thank you for your time and attention.
ref https://github.com/BNFC/bnfc/issues/293
PR description: I modified large amount of source code related with issue #293 . I would like to take a review. If there are any problems in this PR, please point them out. And If it's OK, tell me what unit tests should be added.
PR Summary
bnfc
using
instead oftypedef
std::shared_ptr
bnfc-system-tests
PR contents
Makefile and file extension changes:
--ansi
flag, Makefile would use-std=c++14
compile option otherwise use--ansi
flag.--ansi
flag, bnfc will generate.cc
,.hh
,.yy
,.ll
files for bison/flex. In the nutshell, it represents C++ things.C++ AST/Test code generator switching
--ansi
flag, bnfc would generate codes using smart-pointer (std::shared_ptr), otherwise bnfc generate codes same as before.use
using
instead oftypedef
std::shared_ptr
, like following:std::unique_ptr
, it's not necessary to release memory manually. It's convenient. (std::unique_ptr
is not copy-able. This is not good for storing parsed AST and returning it. On the other hand,std::shared_ptr
is copy-able , furthermore it will be automatically released after their reference count will be 0. So I introducedshared_ptr
. We can find several implmentations usingstd::shared_ptr
as bison's semantic type in the world GitHub. So, this is common implementation.)bison's yy file will be like following; You can find bison's yy file using variant, and shared_ptr.
std::istream &stream
as their parameters. Because it can handle file contents and stdin data. Entrypoints will be generated in "Driver" class.PATTREN
,-n PATTERN
option, make enable filtering of bnfc-system-tests