Currently we don't really have a way of handwriting ASM besides writing bytes or specifying the whole enum variant for each op in Rust code, but this is very Rust-specfic and doesn't feel very "universal".
It'd be nice to have some universal terse shorthand for each op that could be used to show operations in debugging tools, used to handwrite ASM (e.g. in hypothetical ASM blocks, as consts in Rust or potentially even in raw ASM files).
Declaration in asm.yml
We could have an optional shorthand field in the asm.yml that specifies this shorthand, defaulting to the uppercase of the op name in the case that one is not specified, e.g.
Constraint(Stack(Push)) -> PUSH
Constraint(Pred(EqRange)) -> EQRANGE
ControlFlow(Halt) -> HALT
Ops where the behaviour would be otherwise ambiguous using this default name could specify their shorthand in the asm.yml, e.g. StateSlots(LoadWord) could be something like:
As a convention, I'd propose we ensure all shorthands are fully uppercase with no underscores. The benefit of requiring no underscores is that ops can also be written sequentially purely separated by whitespace and still be readable (to the extent asm is readable), e.g.
Currently we don't really have a way of handwriting ASM besides writing bytes or specifying the whole enum variant for each op in Rust code, but this is very Rust-specfic and doesn't feel very "universal".
It'd be nice to have some universal terse shorthand for each op that could be used to show operations in debugging tools, used to handwrite ASM (e.g. in hypothetical ASM blocks, as
const
s in Rust or potentially even in raw ASM files).Declaration in
asm.yml
We could have an optional
shorthand
field in theasm.yml
that specifies this shorthand, defaulting to the uppercase of the op name in the case that one is not specified, e.g.Constraint(Stack(Push))
->PUSH
Constraint(Pred(EqRange))
->EQRANGE
ControlFlow(Halt)
->HALT
Ops where the behaviour would be otherwise ambiguous using this default name could specify their shorthand in the
asm.yml
, e.g.StateSlots(LoadWord)
could be something like:Convention?
As a convention, I'd propose we ensure all shorthands are fully uppercase with no underscores. The benefit of requiring no underscores is that ops can also be written sequentially purely separated by whitespace and still be readable (to the extent asm is readable), e.g.
the ops are above are a little easier to distinguish than below, where its easy to confuse a space and an underscore:
Of course, this is arguably not that important though as most asm tends to be written line-by-line:
but I think the flexibility could be nice for UIs where there might be more horizontal space than vertical.
Fwiw, this shorthand would follow the EVM convention too.