0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
612 stars 150 forks source link

Miden formatting crate #1284

Closed bobbinth closed 3 months ago

bobbinth commented 3 months ago

As mentioned in https://github.com/0xPolygonMiden/miden-vm/pull/1277/files#r1526578953, it might be good to move handling pretty-printing/formatting code into a stand-alone simple crate to avoid current duplication of formatting code across multiple crates.

bitwalker commented 3 months ago

@bobbinth If you set up a repo for it, I can move it over there before we merge #1277, to avoid it ever becoming part of the miden-core API. It would also be a good place for a future masmfmt tool to live, for auto-formatting Miden Assembly.

At some point down the road I'll revisit the MASM parser and implement it in a way that is amenable to implementing a midenfmt and/or language server integration, but the LALRPOP-based one is not a good fit for that, since we lose all of the original source code structure, so we can't really preserve trivia (comments/whitespace) or structure (grouping certain instructions on one line vs separating them on different lines) with it.

bobbinth commented 3 months ago

Created the repo here. Thank you!

bitwalker commented 3 months ago

I think we can close this when both 0xPolygonMiden/miden-formatting#1 and #1277 are merged. Once the former is merged, I'll update the latter, and once the latter is merged this is all sorted.