Skip to content

Modified the Semantic Analyser for DogLang Compiler..#15

Open
AvanishSalunke wants to merge 2 commits into
Pallavrai:mainfrom
AvanishSalunke:Analyser
Open

Modified the Semantic Analyser for DogLang Compiler..#15
AvanishSalunke wants to merge 2 commits into
Pallavrai:mainfrom
AvanishSalunke:Analyser

Conversation

@AvanishSalunke

@AvanishSalunke AvanishSalunke commented Oct 3, 2025

Copy link
Copy Markdown

Introduced a semantic analysis phase and fixes several underlying bugs to improve the stability and correctness of the DogLang compiler.
image
image

Changes done :

  • Implemented the Semantic Analyzer: A new SemanticAnalyser class was created to check the code for logical errors after it is parsed but before it is run by the interpreter.
  • Added Undeclared Variable Checks: The analyser now detects when a variable is used before it has been assigned a value and reports a SemanticError, preventing crashes during runtime.
  • Introduced Type Checking for Conditions: It now validates the conditions inside sniff and wagtail statements to ensure they are boolean comparisons (e.g., a < 10), rejecting incorrect types.
  • Fixed Critical SymbolTable Bug: The SymbolTable was refactored to remove a major bug where it used a global state. It is now instance-based, making the language more stable and predictable.
  • Integrated into the Compiler Pipeline: The Interpreter's flow was updated to include this new analysis step, creating a proper Tokenize -> Parse -> Analyze -> Interpret sequence and establishing a custom SemanticError for clear error messages.

Fixes #2

Kindly go through the changes , I would like to contribute more on this...
Thankyou!

@AvanishSalunke AvanishSalunke changed the title Modified the Semantic Analyser for DogLnag Compiler.. Modified the Semantic Analyser for DogLang Compiler.. Oct 3, 2025
@AvanishSalunke

Copy link
Copy Markdown
Author

@Pallavrai resolved the conflicts that arised do the changes done in the main branch.
Kindly do through the changes..
Thankyou!!

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.

Modify Semantic Analyzer for DogLang Compiler

1 participant