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

Reduce prefix expression with unary minus wrapping literal, to literal with negative value #195

Closed
jlapeyre opened this issue Mar 25, 2024 · 2 comments · Fixed by #220
Closed
Assignees
Labels
Looking for assignee Looking to contribute? Browse these. Not too difficult May be good if you are new to project

Comments

@jlapeyre
Copy link
Collaborator

This has already been done for integer literals and float literals.
It remains to be done for timing literals. Because we have shoehorned imaginary literals into all code for handling timing literals (distinguishing finally when we build the ASG) the same reduction needs to be done for imaginary literals.

Following the pattern for integer and float literals will be quite boiler platey. But it is Rust after all.

For example, here is a part of the ASG structure for -10.1 im;:

expression: UnaryExpr(UnaryExpr { op: Minus, operand: TExpr { expression: Literal(ImaginaryFloat(FloatLiteral { value: "10.1" }))

For a plain-vanilla floating point literal -10.1; this is reduced to

expression: Literal(Float(FloatLiteral { value: "-10.1" }))

See also

@jlapeyre jlapeyre added Looking for assignee Looking to contribute? Browse these. Not too difficult May be good if you are new to project and removed Looking for assignee Looking to contribute? Browse these. labels Mar 25, 2024
atomgardner added a commit to atomgardner/openqasm3_parser that referenced this issue May 29, 2024
@DotandLog
Copy link

Hello John,

I'd be happy to work on this issue.

Could you please provide more details about solving this problem so that I can easily understand where to start?

@atomgardner
Copy link
Contributor

Dear @jlapeyre, could you please assign this issue to me so the UF robot can assign credit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Looking for assignee Looking to contribute? Browse these. Not too difficult May be good if you are new to project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants