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

V3 Extended: Arithmetic Expressions #194

Merged
merged 39 commits into from
Jan 31, 2024

Conversation

rturrado
Copy link
Contributor

Add arithmetic expressions.
These include unary, binary, and ternary operators, as well as a set of default functions (e.g. sin, cos and so on).

FetchContent func-gen/v1x_and_v3x_generators branch.
Update to the latest version of func-gen/v1x_and_v3x_generators branch.
Add expression arithmetic to the parser.
Float literals can end with a dot.

Add expression arithmetic visitor methods to BuildTreeGenAstVisitor.

Update res/v3x/parsing files.
Due to changes in the lexer and the parser.

Update antlr4-cppruntime Conan package version.

We have to add 'Wno-error=unused-parameter' to the Clang compilation.
As CqasmParser::expressionSempred defined _localctx parameter but does not use it.
Add expression arithmetic to the parser.
Float literals can end with a dot.

Add expression arithmetic visitor methods to BuildTreeGenAstVisitor.

Update res/v3x/parsing files.
Due to changes in the lexer and the parser.

Update antlr4-cppruntime Conan package version.

We have to add 'Wno-error=unused-parameter' to the Clang compilation.
As CqasmParser::expressionSempred defined _localctx parameter but does not use it.
…ns' into v3-extended-arithmetic_expressions

# Conflicts:
#	src/v3x/CqasmParser.g4
Implement BuildTreeGenAstVisitor visitor methods for the syntactic AST.
Update to the latest version of func-gen.
… operators.

Update to the latest version of func-gen/v1x_and_v3x_generators.
@rturrado rturrado requested a review from pablolh January 22, 2024 16:39
Which changes constinit const variables from std::string to std::string_view.
Which changes constinit const variables from std::string to std::string_view.
Due to changes in the lexer and the parser.
@rturrado rturrado changed the title V3 Extended: Arithmetic Expressons V3 Extended: Arithmetic Expressions Jan 23, 2024
include/v1x/cqasm-analyzer.hpp Show resolved Hide resolved
src/v3x/AnalyzeTreeGenAstVisitor.cpp Show resolved Hide resolved
src/v3x/BuildTreeGenAstVisitor.cpp Outdated Show resolved Hide resolved
include/v3x/BuildTreeGenAstVisitor.hpp Outdated Show resolved Hide resolved
src/v3x/BuildTreeGenAstVisitor.cpp Show resolved Hide resolved
Update to the latest version of func-gen.
pablolh
pablolh previously approved these changes Jan 23, 2024
Add cqasm-functions files with the current code generated by func-gen.

Add some initial unit tests for AnalyzeTreeGenAstVisitor::visit_function_call(name, arguments).
Add MockAnalyzer.
Add ValuesEqMatcher.

Change src/v3x/Analyzer class methods to virtual.
So that we can mock this class.

TODO: reimplement cqasm-functions using templated code.
TODO: add integration tests.
TODO: add unit tests for cqasm-functions.
TODO: add integration tests.
TODO: add unit tests for cqasm-functions.
Since they are not really needed and make the code less legible.
The errors were mainly coming from the change done to the parser grammar file.
So that tests can be written in a less verbose way.
I prefer to leave the rest of the dynamic_cast's, because using dynamic_pointer_cast makes the code less readable (in my opinion).
pablolh
pablolh previously approved these changes Jan 30, 2024
Copy link

@pablolh pablolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem for me, just nitpicking

include/v1x/cqasm-functions.hpp Outdated Show resolved Hide resolved
include/v1x/cqasm-functions.hpp Show resolved Hide resolved
test/v3x/cpp/AnalyzeTreeGenAstVisitor.cpp Outdated Show resolved Hide resolved
test/v3x/cpp/AnalyzeTreeGenAstVisitor.cpp Outdated Show resolved Hide resolved
test/v3x/cpp/matcher_values.cpp Outdated Show resolved Hide resolved
@rturrado rturrado merged commit 83a35bc into develop Jan 31, 2024
17 checks passed
@rturrado rturrado deleted the v3-extended-arithmetic_expressions branch January 31, 2024 12:46
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