Nothing Special   »   [go: up one dir, main page]

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

Improve error reporting for openqasm semantics #149

Open
TheGupta2012 opened this issue Aug 24, 2024 · 0 comments · May be fixed by #160
Open

Improve error reporting for openqasm semantics #149

TheGupta2012 opened this issue Aug 24, 2024 · 0 comments · May be fixed by #160
Assignees
Labels
enhancement New feature or request

Comments

@TheGupta2012
Copy link
Collaborator
TheGupta2012 commented Aug 24, 2024

Feature Description

Error Emission

  • Currently, the semantic analyser stops at the first error and emits out an error message to the user about the about location and the error.
  • This might be good for a small number of semantic errors but for a lot of errors, the user experience would degrade. They would have to run the analyser as many times as the number of errors which is not desirable.
  • Moreover, if the user has a very large number of errors, spitting out all errors at once could be confusing.
  • A good feature would be to add an error threshold in the analyser. With this, we can keep a list of errors and as soon as the number of errors reach this predefined threshold, we stop and emit all of these errors.

Error Codes

  • Adding unique identifiers to the messages would help locate the line of code quicker than parsing through the python traceback. Eg - OSA_ERR_123: <<error message>> ( OSA: openqasm semantic analyser )

Implementation (Optional)

Questions

  • How to handle the "state" of the analyser once an error is found? Eg. -
OPENQASM 3.0;
array[int[32], 2, 2] my_arr = { {1,2}, {3,4}};
int[32] a = my_arr[0]; // this is semantically incorrect 

qubit q;
if( a == 4) { // what do we refer as "a" here? 
    for int[32] i in [:a] {
         rx(pi * i ) q;
    }
}

In the above example, do we treat a as undefined or invalid? What does "invalid" exactly mean here? How to continue semantic analysis in this erroneous state?

  • What is a good threshold level for errors?
@TheGupta2012 TheGupta2012 added the enhancement New feature or request label Aug 24, 2024
@TheGupta2012 TheGupta2012 self-assigned this Aug 28, 2024
@TheGupta2012 TheGupta2012 linked a pull request Sep 24, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant