Releases: Prime-Lasking/Zlang
Z Compiler v0.13.0
Bug Fixes
High Priority
-
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
Medium Priority
-
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
Low Priority
- Redundant Import Check
- Removed redundant IMPORT handling in codegen.py
- Cleaned up dead code that performed no useful operation
Code Quality
- Removed BUGS.md after fixing all documented issues
- Improved code reliability and safety across all modules
- Enhanced type consistency and memory management
Breaking Changes
None. This release maintains backward compatibility.
Migration Guide
No migration required. Existing Zlang code continues to work without changes.
Z version 0.12.3
Security Fixes
1. Directory Traversal Prevention
- Fixed path validation in validate_input_path()
- Added Windows-specific cross-drive access prevention
- Implemented proper path normalization and validation
- Impact: Prevents malicious file path attacks
2. Subprocess Shell Injection Prevention
- Removed shell=True from subprocess.run() call
- Commands now executed directly without shell interpretation
- Impact: Prevents command injection through malicious filenames
Bug Fixes
1. UnboundLocalError in _handle_let
- Added value_type = None initialization before conditional branches
- Prevents runtime errors by ensuring variable is always defined
2. Incorrect Duplicate Function Check
- Fixed comparison logic to compare actual function names
- Now correctly detects duplicate function declarations
Technical Changes
1. Version Management
- Created version.py to resolve circular import
- Fixed circular dependency between main.py and setup.py
- Enables proper PyInstaller packaging
2. Code Quality
- Added BUGS.md documenting 18 issues found in code review
- Fixed all 4 critical security and functional bugs
Breaking Changes
None. This release maintains backward compatibility.
Migration Guide
No migration required. Existing Zlang code continues to work without changes.
Z version 0.12.2
[0.12.2] - 2024-07-22
🚀 New Features
1. LET Keyword Support
- 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.
🐛 Bug Fixes
1. Keyword Replacement
- 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.
📚 Documentation Updates
1. Updated Example Code
- Comprehensive test suite: The
example.zfile now usesLETinstead ofMOVfor all variable declarations and assignments.
🔧 Technical Changes
1. Lexer.py
- Replaced
MOVwithLETin theOPSset. - Updated parsing logic to handle
LETfor variable declarations and assignments.
2. Optimizer.py
- Updated constant propagation to recognize
LEToperations. - Adjusted dead code elimination to handle
LETassignments. - Modified strength reduction to replace operations with
LET.
3. Semantics.py
- Renamed
_handle_movto_handle_let. - Updated the
HANDLERSdictionary to mapLETto_handle_let.
4. Codegen.py
- Updated code generation logic to handle
LEToperations.
5. Example.z
- Replaced all instances of
MOVwithLET.
📋 Breaking Changes
- MOV Keyword Deprecation: The
MOVkeyword is no longer supported. All existing code must be updated to useLETinstead.
📖 Migration Guide
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
Z version v0.12.1
Changelog
[0.12.1] - 2024-07-21
🚀 New Features
1. Pointer Dereferencing Support
- 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
2. Enhanced Code Generation
- 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
🐛 Bug Fixes
1. Pointer Dereferencing
- 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
2. Fibonacci Calculation
- 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)
3. General Improvements
- 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
📚 Documentation Updates
1. Updated Example Code
- 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
2. Code Quality Improvements
- 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
🔧 Technical Changes
1. Codegen.py
- Added support for pointer dereferencing in MOV assignments
- Enhanced pointer handling in PRINT statements
- Improved code generation for array operations
2. Semantics.py
- Added pointer dereferencing validation in PRINT handler
- Enhanced error messages for pointer operations
- Improved type checking for pointer operations
3. Example.z
- Updated to use working syntax for all features
- Added comprehensive test coverage
- Fixed Fibonacci calculation and pointer dereferencing
🎯 Known Limitations
- 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
📊 Performance Improvements
- 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
🔒 Security Enhancements
- 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
📋 Breaking Changes
None. This release maintains backward compatibility with existing Z language code.
📖 Migration Guide
No migration required.
Z version 0.12 Imports and Modules - 2025-11-18
🎉 Major New Features
- Module System with IMPORT statements - Import functions from other Z files
IMPORT "filename.z"statement support- Recursive compilation of imported modules
- Automatic extraction and integration of non-main functions
- Proper function naming with
z_prefix for internal linkage
🐛 Bug Fixes
- Fixed lexer CALL instruction parsing for space-separated return variables
- Fixed semantic analyzer to properly handle imported function declarations
- Fixed C code generation to include imported functions before main function
- Resolved implicit function declaration errors during C compilation
📝 Documentation
- Added IMPORT examples to README.md
- Updated version to v0.12 across all files
- Enhanced language overview with module system documentation
🔧 Technical Changes
- Enhanced codegen.py with
compile_imported_fileandextract_non_main_functionshelpers - Updated semantics.py
_handle_importmethod to register imported functions - Added IMPORT_ERROR to ErrorCode enum
- Improved error handling for import failures
[0.11.5] - Previous Release
- Windows-first release with integrated setup system
- Single executable distribution
- PATH management and installation features
- Enhanced error handling and validation
- Performance optimizations and robustness improvements
Z version 0.11.5 Updated Aliases - 2025-11-16
Changed Aliases, Removed the -u/-update and -setup/-begin aliases, now when you download the .exe file, all that is needed is to double click it to begin the setup process.
Z version 0.11 Pointers - 2025-11-03
Added
- Pointer Support: Added comprehensive pointer functionality to ZLang
- Declare pointers using
PTR type ptr_name variablesyntax - Print memory addresses using
PRINT ptr - Dereference pointers using
*ptrin PRINT statements - Type safety checks for pointer operations
- Pointer arithmetic support (e.g.,
ADD *ptr 90)
- Declare pointers using
Example Usage
FN main():
MOV int x 10
PTR int ptr x // Create a pointer to x
// Print the value of x through the pointer
PRINT *ptr // Prints: 10
// Print the memory address of x
PRINT ptr // Prints: [memory address]
// Modify x through the pointer using pointer arithmetic
ADD *ptr 90 x
PRINT x // Prints: 100
Changes
- Updated semantic analyzer to handle pointer types and operations
- Enhanced code generator to emit proper C pointer syntax
- Added comprehensive error checking for pointer operations
- Improved type safety for pointer de-referencing
Fixed
- Fixed issues with semantic analysis of pointer operations
- Resolved handler argument passing in the semantic analyzer
- Ensured proper memory address formatting in generated C code
Known Issues
- Pointer arithmetic with non-integer values may have undefined behavior
- Nested pointer support is limited
- No explicit NULL pointer support yet
Note: This is the initial release of pointer support. Please report any issues you encounter.
Z version 0.10: Arrays
This new update has added Arrays something very much needed in Z, more on how arrays work are in the Readme file
Z 0.9.5
Added safeguards for Overflow and boolean with Capital True and capital False. Fixed boolean declarations. Added the Overflow error, error 45.
Z 0.9
Fixed READ, removed immutability by default, added CONST for constants, removed dynamic typing(just defaulted to double all the time), fixed -u.