feynman icon indicating copy to clipboard operation
feynman copied to clipboard

Merge optional OpenQASM 3 parser

Open jlunder opened this issue 1 year ago • 2 comments

@meamy as promised, the beginnings of merging the parser.

Things to note:

  • The only part of the source I modified much was FeynOpt -- everything else is addition, namespaced under Feynman.Frontend.OpenQASM3, in order to maintain some separation
  • I stubbed in some structure matching the existing OpenQASM for the new OpenQASM 3 mode
  • Because the OpenQASM3/Syntax.hs has a lot more going on than the existing OpenQASM one, I put the (currently stub) functions which talk to Feynman's internals in Driver.hs -- this is like check, applyOpt, etc.
  • I added another option, `-qasm3', to trigger use of the new OpenQASM 3 parser; the default is to use the old interface
  • This entailed some changes to the existing argument parser, and I created an Options type to handle what was being done by the bools previously; 2 random flags is fine for a quick and dirty arg parse, 3 was too many for my comfort (it's just asking for someone to mix up the order)
  • I also namespaced the functions for both the DotQC and original OpenQASM parsers to avoid confusion, since now there are 3 different frontends that FeynOpt.hs is talking to

I intend to continue updating this branch, the PR is just so we have a place to discuss the source code.

jlunder avatar Jul 07 '24 00:07 jlunder

This first iteration should just behave like normal FeynOpt until you pass in -qasm3, and then it will error out with a Prelude.undefined because the Driver.hs is currently not implemented. Next step is to wire that all in, and fix any issues that shake out of the rest of the merge. I'll be at it again tomorrow.

jlunder avatar Jul 07 '24 00:07 jlunder

Thanks @jlunder! Just going through your code now. Going to prioritize getting a working example up and running and then I'll go through in more detail and make comments.

meamy avatar Jul 08 '24 19:07 meamy