powdr-labs / powdr

A modular stack for zkVMs, with a focus on productivity, security and performance.
Apache License 2.0
416 stars 82 forks source link

isa-utils: filter special characters the zig compiler uses in function names #2138

Closed gballet closed 1 day ago

gballet commented 2 days ago

Some riscv32 compilers like zig, will use symbols with many more special characters than others (e.g. [, ], `,{,},*`...)

To give an example of a symbol I need powdr to support: io.GenericWriter(*io.fixed_buffer_stream.FixedBufferStream([]u8),error{NoSpaceLeft},(function 'write')).typeErasedWriteFn

This PR will simply escape these symbols like the . and / already are.

It was initially suggested to update the grammar. I learned how larlpop works for that, but I ended up into a rabbit hole when I discovered that some symbols contain ,, which wreaks havoc with ExpressionLists. Someone with a better command of larlpop might be able to fix the problem this way, but I figured this was good enough for now, as my foray into using zig in powdr will likely reveal more symbols later down the road.