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

Phase 2 #8

Merged
merged 5 commits into from
Dec 4, 2024
Merged

Phase 2 #8

merged 5 commits into from
Dec 4, 2024

Conversation

itsfuad
Copy link
Owner

@itsfuad itsfuad commented Dec 4, 2024

This pull request includes significant changes to error handling, the lexer, and the parser, as well as updates to the language's type and struct definitions. The most important changes are summarized below:

Error Handling Enhancements:

  • Introduced an ERROR_LEVEL type with different levels of error severity (ERROR_CRITICAL, ERROR_NORMAL, WARNING, INFO) and integrated it into the WalrusError struct. Critical errors now stop further execution and display a message indicating compilation has stopped. (errgen/errorPrinter.go, errgen/errorPrinter_test.go) [1] [2] [3] [4] [5] [6] [7] [8] [9]

Lexer Improvements:

  • Added support for compound assignment operators (+=, -=, *=, /=, %=, ^=) in the lexer. (lexer/tokenizer.go)
  • Updated error handling to use the new ERROR_CRITICAL level for unexpected characters. (lexer/tokenizer.go)

Parser Enhancements:

  • Updated various parsing functions to use the new ERROR_CRITICAL level for error reporting, ensuring critical parsing errors halt further processing. (parser/expr.go, parser/functions.go) [1] [2] [3] [4] [5] [6]

Type and Struct Updates:

  • Added new types and struct definitions, including Circle, Rectangle, and IShape interface with an implementation for Rectangle. Introduced type aliasing and tested type compatibility and method implementations. (language/types.wal)
  • Updated StructLiteral to use a new StructProp type for properties, allowing for more detailed property definitions. (ast/expr.go)

Miscellaneous Changes:

  • Modified PrintError function to improve the formatting of error messages, including color changes and additional information for critical errors. (errgen/errorPrinter.go) [1] [2] [3]
  • Adjusted test cases to reflect changes in error handling and added new tests for hints and error levels. (errgen/errorPrinter_test.go)

@itsfuad itsfuad added the enhancement New feature or request label Dec 4, 2024
@itsfuad itsfuad merged commit 83711fb into main Dec 4, 2024
1 check passed
@itsfuad itsfuad deleted the Phase-2 branch February 17, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant