Skip to content
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 27 commits into from
Dec 6, 2023
Merged

tree-gen classes can now dump to JSON #166

merged 27 commits into from
Dec 6, 2023

Conversation

rturrado
Copy link
Contributor

@rturrado rturrado commented Nov 16, 2023

Updated libqasm to use the latest commit ID for tree-gen/develop.

ParseResult and AnalysisResult now have to_json methods.
They both end up using a function template to_json implemented in include/cqasm-utils.hpp.
Moved ParseResult and AnalysisResult 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.

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.
@rturrado rturrado requested a review from pablolh November 16, 2023 20:55
…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'.
src/v3x/cqasm-py.cpp Outdated Show resolved Hide resolved
include/v3x/cqasm-analyzer.hpp Show resolved Hide resolved
test/cqasm-utils.cpp Outdated Show resolved Hide resolved
python/module/cqasm/v3x/__init__.py Outdated Show resolved Hide resolved
{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
pablolh previously approved these changes Dec 5, 2023
@pablolh
Copy link
Contributor

pablolh commented 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.
@rturrado
Copy link
Contributor Author

rturrado commented Dec 5, 2023

Sorry for the delay!

No worries Pablo. I've merged develop into json_dumper, fixed some things I screwed up during the merge, and now I need your approval again.

@rturrado rturrado merged commit ec516cf into develop Dec 6, 2023
13 of 15 checks passed
@rturrado rturrado deleted the json_dumper branch December 6, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants