-
Closure Bug in Handler Creation
- Fixed late binding issue in semantics.py handler creation
- Use default argument to properly capture loop variable values
-
Redundant Dead Code
- Removed unreachable code in main.py run_after_compile check
-
Incomplete Type Mapping
- Added missing print_double function for float/double types
- Ensures proper printing of floating-point values
-
Incorrect Operand Indexing
- Fixed constant propagation to check correct operand index
- Value is now correctly identified as last operand in LET instructions
-
Flawed Dead Code Elimination
- Improved dead code elimination to properly track variable usage
- Now distinguishes between reads and writes for accurate analysis
-
Incorrect ELSE Detection
- Fixed lexer to use word boundary regex for ELSE: detection
- Prevents incorrect matching of patterns like ELSE:IF
-
Missing Handler Entries
- Removed non-existent handler entries from HANDLERS dictionary
- Cleaned up WHILE, FOR, CONST, READ, and ERROR mappings
-
Inconsistent Array Type Mapping
- Changed Astring mapping from char* to const char* for consistency
- Aligns with string handling throughout the codebase
-
Potential Integer Overflow
- Fixed overflow check to use proper type casting
- Result now explicitly cast to int after overflow check
-
Memory Leak in array_free
- Added NULL check before freeing string elements
- Prevents undefined behavior from freeing NULL pointers
- Redundant Import Check
- Removed redundant IMPORT handling in codegen.py
- Cleaned up dead code that performed no useful operation
- Removed BUGS.md after fixing all documented issues
- Improved code reliability and safety across all modules
- Enhanced type consistency and memory management
None. This release maintains backward compatibility.
No migration required. Existing Zlang code continues to work without changes.
- Fixed path validation: Implemented proper directory traversal prevention in
validate_input_path() - Cross-drive protection: Added Windows-specific cross-drive access prevention
- Path normalization: Added proper path normalization and validation
- Impact: Prevents malicious file path attacks that could escape intended directories
- Removed shell=True: Removed
shell=Truefrom subprocess.run() call in program execution - Safe command execution: Commands now executed directly without shell interpretation
- Impact: Prevents command injection through malicious output filenames
- Fixed variable initialization: Added
value_type = Noneinitialization before conditional branches - Prevents runtime errors: Ensures variable is always defined before use
- File:
semantics.py
- Fixed comparison logic: Updated duplicate function check to compare actual function names
- Proper detection: Now correctly detects duplicate function declarations
- File:
semantics.py
- Created version.py: Extracted VERSION to separate module to resolve circular import
- Fixed circular dependency: Resolved import cycle between main.py and setup.py
- Impact: Enables proper PyInstaller packaging
- Added BUGS.md: Created comprehensive bug tracking document
- Security audit: Conducted full code review identifying 18 issues
- Fixed all critical bugs: Resolved 4 critical security and functional bugs
None. This release maintains backward compatibility.
No migration required. Existing Zlang code continues to work without changes.
- Replaced MOV with LET: The
MOVkeyword has been replaced withLETfor variable declarations and assignments. - Enhanced readability: The
LETkeyword improves code clarity and aligns with modern programming language conventions.
- Updated lexer: Modified the lexer to recognize
LETinstead ofMOV. - Updated optimizer: Adjusted the optimizer to handle
LETfor constant propagation, dead code elimination, and strength reduction. - Updated semantics analyzer: Updated the semantics analyzer to validate
LEToperations. - Updated code generator: Modified the code generator to emit C code for
LEToperations.
- Comprehensive test suite: The
example.zfile now usesLETinstead ofMOVfor all variable declarations and assignments.
- Replaced
MOVwithLETin theOPSset. - Updated parsing logic to handle
LETfor variable declarations and assignments.
- Updated constant propagation to recognize
LEToperations. - Adjusted dead code elimination to handle
LETassignments. - Modified strength reduction to replace operations with
LET.
- Renamed
_handle_movto_handle_let. - Updated the
HANDLERSdictionary to mapLETto_handle_let.
- Updated code generation logic to handle
LEToperations.
- Replaced all instances of
MOVwithLET.
- MOV Keyword Deprecation: The
MOVkeyword is no longer supported. All existing code must be updated to useLETinstead.
To migrate from MOV to LET, replace all instances of MOV with LET in your Zlang code. For example:
// Before
MOV int x 10
// After
LET int x 10
- Added pointer dereferencing in PRINT statements: You can now use
PRINT *ptrto dereference and print pointer values - Added pointer dereferencing in MOV assignments: You can now use
MOV dest *ptrto dereference pointers in assignments - Enhanced semantics validation: Added proper validation for pointer dereferencing operations
- Improved pointer handling: Better code generation for pointer operations
- Enhanced array operations: More robust array handling in generated C code
- Improved error messages: More descriptive error messages for pointer-related operations
- Fixed pointer dereferencing in PRINT statements: Previously,
PRINT *ptrwould cause a semantics error - Fixed pointer dereferencing in MOV assignments: Previously,
MOV dest *ptrwas not supported - Fixed semantics analyzer: Added proper handling for pointer dereferencing syntax
- Fixed FOR loop syntax: Corrected the FOR loop variable initialization issue
- Fixed loop variable scoping: Ensured FOR loop variables are properly declared and initialized
- Fixed Fibonacci algorithm: The Fibonacci sequence now calculates correctly (fib(10) = 55)
- Fixed type checking errors: Resolved various type checking issues in the codebase
- Improved code consistency: Enhanced code formatting and organization
- Better error handling: More robust error handling throughout the compiler
- Comprehensive test suite: The
example.zfile now demonstrates all working features - Pointer examples: Added working examples of pointer usage and dereferencing
- Algorithm examples: Added Fibonacci sequence calculation example
- Enhanced code comments: Added more descriptive comments throughout the codebase
- Improved variable naming: More consistent and descriptive variable names
- Better code organization: Improved structure and organization of the code
- Added support for pointer dereferencing in MOV assignments
- Enhanced pointer handling in PRINT statements
- Improved code generation for array operations
- Added pointer dereferencing validation in PRINT handler
- Enhanced error messages for pointer operations
- Improved type checking for pointer operations
- Updated to use working syntax for all features
- Added comprehensive test coverage
- Fixed Fibonacci calculation and pointer dereferencing
- Constants: The
CONSTkeyword still causes recursion issues in the current compiler - Float/Double Types: Missing
print_doublefunction in codegen - PRINTSTR: Not implemented in codegen (using
PRINTwith string literals as workaround) - Discard Variables: The
_variable for discarding function return values has issues in semantics validation
- Faster compilation: Optimized code generation and semantics analysis
- Reduced memory usage: More efficient handling of variables and arrays
- Better error reporting: More descriptive and helpful error messages
- Improved input validation: Better validation of pointer operations
- Enhanced error handling: More robust handling of edge cases
- Better memory management: Improved cleanup of temporary variables
None. This release maintains backward compatibility with existing Z language code.
No migration required.