-
Notifications
You must be signed in to change notification settings - Fork 16
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
tree-gen classes can now dump to JSON #166
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have only enabled the checks for one test for the time being. Since these are file-based checks, enabling them for all the tests may be quite time consuming.
…cause gtest doesn't like test names with dashes. This is a fix of commit 7951995, from 04/11/2023 21:00.
Updated to use the latest commit ID for tree-gen/develop. Moved ParseResult and AnalysisResult into separate classes. Added test/cqasm-result-to-json.cpp. Implemented src/v3x/cqasm.cpp default_analyzer to use in tests.
Some tests were failing due to different line endings between actual and golden files. And some because, some commits ago, 'api_version' was moved to the top of the semantic AST, right before 'version'.
pablolh
reviewed
Nov 27, 2023
{v1x,v3x}/cqasm-py.cpp: used member initializer lists. Created test/{v1x,v3x}/{cpp,python} folder structure. Added test/{v1x,v3x}/python/test_{parse,analysis}_result.py. TODO: get tests/{v1x,v3x}/python working.
The analyzer functions always return a vector of strings. And, in this vector, the first string is reserved for the serialized AST. The next strings are filled with error messages, if any.
We also need to convert every error from a "libQasm string" to a "Python string" before returning.
…_json, and analyze_string_to_json. Both in V1xAnalyzer and V3xAnalyzer. Implemented test_parse_result.py and test_analysis_result.py. Both in test/v1x and test/v3x.
conda seems to be missing numpy.
pablolh
reviewed
Dec 4, 2023
pablolh
previously approved these changes
Dec 5, 2023
Sorry for the delay! |
# Conflicts: # include/v3x/cqasm-py.hpp # pyproject.toml # python/module/cqasm/v1x/__init__.py # python/module/cqasm/v3x/__init__.py # python/module/libQasm/__init__.py # src/v1x/cqasm-py.cpp # src/v3x/cqasm-py.cpp # test/v1x/CMakeLists.txt # test/v3x/CMakeLists.txt
Introduced when merging develop into json_dumper branch.
Introduced when merging develop into json_dumper branch.
No worries Pablo. I've merged |
pablolh
approved these changes
Dec 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated
libqasm
to use the latest commit ID fortree-gen/develop
.ParseResult
andAnalysisResult
now haveto_json
methods.They both end up using a function template
to_json
implemented ininclude/cqasm-utils.hpp
.Moved
ParseResult
andAnalysisResult
into separate classes.Updated v3x parsing tests to check the JSON dump.
I have only enabled the checks for one test for the time being,
res/v3x/parsing/sgmq/cnot_q_at_0_and_1_q_at_3_and_2
.Since these are file-based checks, enabling them for all the tests may be quite time consuming.
Added tests to
test/cqasm-utils.cpp
.Implemented
src/v3x/cqasm.cpp default_analyzer
to be used in tests.