0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
621 stars 158 forks source link

allow odd number of characters in hex constants #1302

Open hackaugusto opened 6 months ago

hackaugusto commented 6 months ago

the following code:

begin
    push.0x100
end

fails to assemble with the following error code:

Failed to parse program file `t.masm` - parsing error at [2:5]: malformed instruction 'push.0x100', parameter 0x100 is invalid: hex string '100' does not contain an even number of characters

However, 0x100 is a valid representation of the number 128. As an example, the following program:

fn main() {
    println!("{}", format!("0x{:02x}", 256));
}

Will print 0x100 when executed. This is causing test failures in miden-base when similar logic is used to format an account id for testing.

Bisht13 commented 5 months ago

Is this fixed? If not, I can pick this up.

bitwalker commented 5 months ago

I believe the parser still requires there to be an even number of hex digits, so I believe this is still an open issue @Bisht13