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

Reorganize location and visibility of functions in oq3_parser #166

Open
jlapeyre opened this issue Feb 28, 2024 · 0 comments
Open

Reorganize location and visibility of functions in oq3_parser #166

jlapeyre opened this issue Feb 28, 2024 · 0 comments
Labels
Looking for assignee Looking to contribute? Browse these. tech debt Pay down some tech debt

Comments

@jlapeyre
Copy link
Collaborator

jlapeyre commented Feb 28, 2024

/// `Parser` struct provides the low-level API for
/// navigating through the stream of tokens and
/// constructing the parse tree. The actual parsing
/// happens in the [`grammar`](super::grammar) module.
///
/// However, the result of this `Parser` is not a real
/// tree, but rather a flat stream of events of the form
/// "start expression, consume number literal,
/// finish expression". See `Event` docs for more.

The "actual parsing" mentioned above is spread out among these files in this directory and subdirectory:
https://github.com/Qiskit/openqasm3_parser/tree/main/crates/oq3_parser/src/grammar

I have not audited this recently, but these files should probably be reorganized.

A couple of examples:

  • There may a be a function that is called only from one file. In some cases it would be better to move this function from its current location to the file with the call sites, and make its visibility more restricted by removing pub or pub(crate).

  • No intentional order determines where the functions appear in the file. Some thought should be put into this and the functions (and data) should be reordered so that the code is easier to read and understand.

@jlapeyre jlapeyre added the tech debt Pay down some tech debt label Feb 29, 2024
@jlapeyre jlapeyre added the Looking for assignee Looking to contribute? Browse these. label Mar 26, 2024
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. tech debt Pay down some tech debt
Projects
None yet
Development

No branches or pull requests

1 participant