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

[FEATURE] Improve Error handling for semantic analysis #11

Open
TheGupta2012 opened this issue Oct 14, 2024 · 0 comments
Open

[FEATURE] Improve Error handling for semantic analysis #11

TheGupta2012 opened this issue Oct 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@TheGupta2012
Copy link
Contributor

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)

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?
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

No branches or pull requests

1 participant