Skip to content

Conversation

@jku20
Copy link
Collaborator

@jku20 jku20 commented Oct 2, 2025

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.

@jku20 jku20 requested a review from sampsyo October 2, 2025 23:15
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.
@jku20 jku20 force-pushed the fud2/json-flang-parser branch from f5dc6d3 to 629aad0 Compare October 2, 2025 23:20
Copy link
Contributor

@sampsyo sampsyo left a 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.

let ast = serde_json::from_str(&input);
match ast {
Err(e) => {
eprintln!("error: {e}");
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

@jku20 jku20 merged commit 18016cd into main Oct 20, 2025
18 checks passed
@jku20 jku20 deleted the fud2/json-flang-parser branch October 20, 2025 13:59
KarlJoad added a commit to Chil-HW/chil that referenced this pull request Oct 22, 2025
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
KarlJoad added a commit to Chil-HW/chil that referenced this pull request Oct 25, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants