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

allow more letters in identifiers #333

Merged
merged 4 commits into from
Nov 17, 2024
Merged

allow more letters in identifiers #333

merged 4 commits into from
Nov 17, 2024

Conversation

fblanqui
Copy link
Member

@fblanqui fblanqui commented Nov 6, 2024

The main modifs are in parsing/lexer.mll and parsing/menhir_parser.mly.
Spaces are added in test files (e.g. writing A -> A instead of A->A).
The error code for tests/KO/nsteps1.dk (#EVAL[-1]) is changed in tests/main.ml from lexing error to scoping error because '-' is now allowed in identifiers but the argument of #EVAL must be a non-negative integer.

gabrielhdt
gabrielhdt previously approved these changes Nov 16, 2024
Copy link
Member

@gabrielhdt gabrielhdt left a comment

Choose a reason for hiding this comment

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

LGTM, a few nitpicks.

@@ -27,7 +27,9 @@ let mk_config loc lid =
| "CBN" when !strat = None -> strat := Some ByName
| "CBV" when !strat = None -> strat := Some ByValue
| "CBSV" when !strat = None -> strat := Some ByStrongValue
| i when !nb_steps = None -> nb_steps := Some (int_of_string i)
| i when !nb_steps = None ->
let n = int_of_string i in
Copy link
Member

Choose a reason for hiding this comment

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

int_of_string can raise a Failure exception, you may want to catch it, don't you?

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that Failure was not specifically caught before either. It is caught a few lines later and generates a scoping error:

with _ -> raise @@ Scoping_error(loc, "invalid command configuration")

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think that we should introduce a more specific error?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say it depends if you really expect it to happen, or if it's an assert false kind of failure (but at least you want to know where it came from as a developer, if it ever happens)

tests/main.ml Show resolved Hide resolved
@fblanqui fblanqui merged commit 3b4ea42 into Deducteam:master Nov 17, 2024
5 checks passed
@fblanqui fblanqui deleted the lex branch November 17, 2024 18:06
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.

' not allowed at the beginning of an identifier
2 participants