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 chapter 5, 6 and 7 #15

Merged
merged 3 commits into from
Sep 29, 2024
Merged

Add chapter 5, 6 and 7 #15

merged 3 commits into from
Sep 29, 2024

Conversation

lynzrand
Copy link
Collaborator

No description provided.

Copy link

peter-jerry-ye-code-review bot commented Sep 29, 2024

Issues Discovered in lec5.mbt

  1. Potential Typographical Error in Comment:

    • In the Mul case of the ast_to_knf function, the comment reads:
      // let a_name = <a> in
      // let b_name = <b> in
      // a_name * b_name
      The angle brackets <a> and <b> might be a typographical error. They should likely be:
      // let a_name = ast_to_knf(env, a) in
      // let b_name = ast_to_knf(env, b) in
      // a_name * b_name
      This aligns with how the variables are actually being defined in the code.
  2. Potential Omission in main Function:

    • In the main function, the ast_to_knf function is called but the environment (AstToKnfEnv) is not updated after the call. Since AstToKnfEnv contains a mutable counter, it might be necessary to pass the environment by reference or ensure it's updated correctly if further calls are made that depend on the updated counter. However, given the current scope and usage, this might not be an issue, but it's something to be aware of for future extensions or modifications.
  3. Use of derive for Ast and Knf Enums:

    • The Ast and Knf enums use derive(Eq, Show). This is a convenient way to automatically implement the Eq and Show traits for these types. However, it's worth noting that derived implementations might not always meet specific requirements, especially if the types become more complex. For instance, the derived Eq might not handle custom equality logic, and the derived Show might not produce the most readable output for all use cases. These are generally fine for basic types and structures but could be revisited if more control over these behaviors is needed in the future.

These observations are based on a quick review of the provided code and context. They highlight potential areas for improvement or caution, especially concerning clarity and future maintainability.

@lynzrand
Copy link
Collaborator Author

@Kukicosmos

@lynzrand lynzrand merged commit 37df0e2 into main Sep 29, 2024
1 check passed
@lynzrand lynzrand deleted the ch5 branch September 29, 2024 03:25
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.

1 participant