Yul identifiers inconsistently treat builtins/keywords
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
For example, [yul-variable-declaration](https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.yulVariableDeclaration) specifies one or more yul-identifiers on the left hand side; yul-identifier is a separate rule from yul-evm-builtin, so I assume in practice this means that yul-identifier excludes all evm builtins. However, yul-path (part of yul-expression) specifies only yul-identifier as the first segment.
The following code is allowed:
```solidity
contract C {
uint number;
function f() external {
assembly {
// whereas declaring 'number' inside is not
// let number := 0
sstore(number.slot, 1)
}
}
}
```
I believe the implementation is correct, but the grammar is missing this nuance.
Encountered in Optimism: https://github.com/ethereum-optimism/optimism/blob/5229fa195415136e5589787c5850101d06b15748/packages/contracts-bedrock/src/L2/L1Block.sol#L169-L170
Contributor guide
Research direction
The report names yul-variable-declaration, yul-identifier, yul-evm-builtin, and yul-path, with an example in Optimism's L1Block.sol. Start by comparing these grammar rules with the implementation; done when the grammar consistently documents how builtins and keywords are treated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100