-
Couldn't load subscription status.
- Fork 60
[fud2] Json Parser for Serialized Plans #2564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adds a new planner, json. This reads from stdin one plan specified in the JSON form of flang. Additionally adds one new mode, json-plan. This takes the plan from the current planner and writes it to stdout in JSON syntax.
f5dc6d3 to
629aad0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!!! I now understand the setup here for the internal Flang language, and the way you've inserted serialization & deserialization into the CLI looks perfect. I only ended up with a few really low-level suggestions, and nothing really conceptual.
fud2/fud-core/src/exec/driver.rs
Outdated
| let ast = serde_json::from_str(&input); | ||
| match ast { | ||
| Err(e) => { | ||
| eprintln!("error: {e}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this (and the one above) should just panic? Not sure this is really a recoverable type of error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't really recoverable, but I don't think a panic is the right move here. It's very easy for a user to trigger this (for example putting gibberish as input to the json planner). My understanding is it's generally bad style to panic (opposed to printing some error message) on response to any user's input.
This TODO was prompted by Calyx's fud2 adding serialization and deserialization support in [1], with an initial implementation in [2]. [1] calyxir/calyx#2555 [2] calyxir/calyx#2564
This TODO was prompted by Calyx's fud2 adding serialization and deserialization support in [1], with an initial implementation in [2]. [1] calyxir/calyx#2555 [2] calyxir/calyx#2564
This serializes fud2 using JSON and a language called flang. See #2555 for more details. In short this PR adds one new planner:
json. It reads a plan from stdin specified in the JSON form of flang.Additionally the PR adds one new mode:
json-plan, taking the plan from the current planner and writing it to stdout in JSON syntax of flang.