Skip to content

Comments

Introducing control flow, logical operators, new configuration system and more -release#3

Merged
ElshadHu merged 17 commits intomainfrom
develop
Dec 19, 2025
Merged

Introducing control flow, logical operators, new configuration system and more -release#3
ElshadHu merged 17 commits intomainfrom
develop

Conversation

@danqzq
Copy link
Owner

@danqzq danqzq commented Dec 19, 2025

Release v1.1.0

This PR includes all changes since the v1.0.0 release, introducing significant new features and improvements to the wtf-script interpreter.

Added

Control Flow

  • If statements: Implemented if and ifrand statements with comprehensive comparison operators (==, !=, <, <=, >, >=)
  • Logical operators: Added support for && (AND), || (OR) and ! (NOT) with short-circuit evaluation
  • Block statements: Full support for code blocks within control structures { }
  • Added if.wtf and logical.wtf demonstration tests under "examples" folder

Configuration System

  • Added config.json for customizable default random ranges of default types
  • Custom configuration files can be passed via --config <config file> optional argument into executable
  • Default min and max random string lengths are now configurable

Code Organization

  • New constants.go for centralized constant definitions in the interpreter module
  • New logger.go for centralized logging behaviour
  • Template functions defaultApplyOp and defaultComparisonOp for operator handling and defaultTypeCompatibility function for type checking and code

Changed

Type System

  • Enhanced type compatibility checks for unofloat across operations
  • Strengthened uint/unofloat validation and type handling
  • Variable type checks are now possible with the typeof() built-in function

Error Handling

  • Replaced individual line/column fields with unified Position struct
  • Enhanced error messages with better context
  • Better type mismatch error reporting

Testing

  • New comprehensive tests for lexer, parser and interpreter functionality
  • Enhanced interpreter Go tests
  • Reorganized and cleaned up test examples

Documentation

  • Updated spec.md with new language features
  • Updated configuration documentation to reference config.json
  • Improved README with latest features

Fixed

  • Type compatibility issues between uint and unofloat
  • Variable assignment validation
  • Proper unofloat handling in various operations

Removed

  • Deleted ast_test.go (tests reorganized)
  • Cleaned up deprecated error examples
  • Removed no longer used functions left out from previous alterations

…nofloat assignments; improve error messages and type checks
…n operators; add block statement support and example tests
…valuation; enhance parser, lexer, and interpreter; include comprehensive tests
…r types and related functions; enhance error handling consistency
…and defaultComparisonOp template functions; improve code readability and maintainability
…peCompatibility function; enhance error handling for type mismatches
…ce interpreter to utilize config values for random generation
- Introduced a series of tests for the lexer covering basic tokens, operators, keywords, literals, comments, whitespace handling, and edge cases.
- Enhanced parser tests to include control flow statements, operator handling, type declarations, function calls, and complex program structures.
- Implemented string representation tests for AST nodes to ensure correct output formatting.
- Added error recovery tests to validate parser robustness against malformed input.
@danqzq danqzq requested a review from ElshadHu December 19, 2025 08:07
@danqzq danqzq self-assigned this Dec 19, 2025
@danqzq danqzq added the enhancement New feature or request label Dec 19, 2025
@ElshadHu
Copy link
Collaborator

Thanks G!!! That is amazing. I loved it🥳.

@ElshadHu ElshadHu merged commit d0b5705 into main Dec 19, 2025
2 checks passed
@danqzq
Copy link
Owner Author

danqzq commented Dec 19, 2025

Thank you fatty 👋😊

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.

2 participants