Concrete syntax of Yul.
The concrete syntax is defined by an ABNF grammar based on the grammar in [Yul]. We parse the ABNF grammar into an ACL2 representation.
A complete specification of the concrete syntax of Yul would need to complement the grammar with predicates that define and relate the two levels of lexical and syntactic sub-grammars, and also restrict certain grammar rules. We plan to do that in the future.
We also provide a parser of Yul, based on our ABNF grammar. The parser is currently not verified, but it follows the grammar closely. The primary API for parsing Yul is parse-yul and parse-yul-bytes.
There are currently two published grammars of Yul: one is in [Yul: Specification of Yul]; the other is part of the Solidity grammar in [Solidity: Language Grammar]. The Yul team has told us that the former is older than the latter, and that the plan is to have a separate Yul grammar along the lines of the one that is part of the Solidity grammar. For now, we formalize both grammars in ABNF, and we parse both grammars into ACL2. (The reason is somewhat accidental: we initially formalized and parsed the older grammar, after which we were told that the other grammar is newer; but since we have the old one formalized and parsed already, we like to keep it for now, along with the new one.
The old and new grammar have the following differences:
Since the new grammar is newer, the rest of our Yul formalization and tools is based on it. We keep the old grammar around just for historical reasons, but we use the unqualified `grammar' to denote the new grammar, except in a few cases when talking about both new and old grammar. We qualify the old grammar with `old'.