wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

cranelift: ISLE printer

Open mmcloughlin opened this issue 1 year ago • 2 comments
trafficstars

This PR adds a printer to the ISLE library. This is intended to support tooling which generates ISLE source code. In such cases, this printer library allows applications to work with ISLE's AST types rather than raw string manipulation, and produce more readable output due to the pretty-printing features.

Printing is implemented using the pretty crate, which in turn is an implementation of Wadler's classic Haskell pretty printer for Rust. In order to avoid required dependencies the printer module is guarded by a new printer feature.

The printer is tested with a new integration test that verifies the print-parse roundtrip property for provided ISLE files.

In the future, it's possible that an ISLE printer could be used to provide an islefmt tool, but comment representation in the AST would be required before that could be considered.

mmcloughlin avatar Mar 29 '24 02:03 mmcloughlin

Adding myself as a reviewer; happy to take a look at this at the beginning of next week (thanks!). For context for folks, this comes out of the ISLE-based Cranelift verification project.

cfallin avatar Mar 29 '24 02:03 cfallin

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

github-actions[bot] avatar Mar 29 '24 02:03 github-actions[bot]