Skip to content
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

Add a parse command #198

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add a parse command #198

wants to merge 3 commits into from

Conversation

janheuer
Copy link
Collaborator

@janheuer janheuer commented Mar 3, 2025

This PR fixes #176

The parse command has two arguments:

  1. parse-as to choose what the input is parse as (i.e. program, theory, specification or user guide)
  2. output either debug output or the default output

@janheuer janheuer requested a review from teiesti March 3, 2025 07:20
Parse {
/// What to parse the input as
#[arg(long, value_enum)]
parse_as: ParseAs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest renaming this into as because

anthem parse --as program file.lp

feels much more natural than

anthem parse --parse-as program file.lp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZachJHansen Btw, is the word as proper English grammar here or is anthem parse --into ... better?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either is fine - I prefer "as"

@@ -22,6 +22,20 @@ pub enum Command {
input: Option<PathBuf>,
},

/// Parse and output an input
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

pub enum Output {
#[default]
Debug,
Default,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it rather weird to have a Debug that is the default and a Default that is not. Given the fact that these names originate form the names of our formatters, I suggest not to rename things here. I'd also suggest not to change the default as the Debug output is much more helpful than the Default output.

That said, I my improvement ideas are limited -- and I would give this a pass if we are unable to find something better.

@teiesti teiesti self-assigned this Mar 25, 2025
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.

Add a "parse" command
3 participants