Skip to content

Releases: Prime-Lasking/Zlang

Z Compiler v0.13.0

14 Apr 00:39

Choose a tag to compare

Bug Fixes

High Priority

  1. Closure Bug in Handler Creation

    • Fixed late binding issue in semantics.py handler creation
    • Use default argument to properly capture loop variable values
  2. Redundant Dead Code

    • Removed unreachable code in main.py run_after_compile check
  3. Incomplete Type Mapping

    • Added missing print_double function for float/double types
    • Ensures proper printing of floating-point values
  4. Incorrect Operand Indexing

    • Fixed constant propagation to check correct operand index
    • Value is now correctly identified as last operand in LET instructions
  5. Flawed Dead Code Elimination

    • Improved dead code elimination to properly track variable usage
    • Now distinguishes between reads and writes for accurate analysis

Medium Priority

  1. Incorrect ELSE Detection

    • Fixed lexer to use word boundary regex for ELSE: detection
    • Prevents incorrect matching of patterns like ELSE:IF
  2. Missing Handler Entries

    • Removed non-existent handler entries from HANDLERS dictionary
    • Cleaned up WHILE, FOR, CONST, READ, and ERROR mappings
  3. Inconsistent Array Type Mapping

    • Changed Astring mapping from char* to const char* for consistency
    • Aligns with string handling throughout the codebase
  4. Potential Integer Overflow

    • Fixed overflow check to use proper type casting
    • Result now explicitly cast to int after overflow check
  5. Memory Leak in array_free

    • Added NULL check before freeing string elements
    • Prevents undefined behavior from freeing NULL pointers

Low Priority

  1. 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

12 Apr 10:25
bb4dab0

Choose a tag to compare

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

14 Dec 07:32

Choose a tag to compare

[0.12.2] - 2024-07-22

🚀 New Features

1. LET Keyword Support

  • Replaced MOV with LET: The MOV keyword has been replaced with LET for variable declarations and assignments.
  • Enhanced readability: The LET keyword improves code clarity and aligns with modern programming language conventions.

🐛 Bug Fixes

1. Keyword Replacement

  • Updated lexer: Modified the lexer to recognize LET instead of MOV.
  • Updated optimizer: Adjusted the optimizer to handle LET for constant propagation, dead code elimination, and strength reduction.
  • Updated semantics analyzer: Updated the semantics analyzer to validate LET operations.
  • Updated code generator: Modified the code generator to emit C code for LET operations.

📚 Documentation Updates

1. Updated Example Code

  • Comprehensive test suite: The example.z file now uses LET instead of MOV for all variable declarations and assignments.

🔧 Technical Changes

1. Lexer.py

  • Replaced MOV with LET in the OPS set.
  • Updated parsing logic to handle LET for variable declarations and assignments.

2. Optimizer.py

  • Updated constant propagation to recognize LET operations.
  • Adjusted dead code elimination to handle LET assignments.
  • Modified strength reduction to replace operations with LET.

3. Semantics.py

  • Renamed _handle_mov to _handle_let.
  • Updated the HANDLERS dictionary to map LET to _handle_let.

4. Codegen.py

  • Updated code generation logic to handle LET operations.

5. Example.z

  • Replaced all instances of MOV with LET.

📋 Breaking Changes

  1. MOV Keyword Deprecation: The MOV keyword is no longer supported. All existing code must be updated to use LET instead.

📖 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

13 Dec 09:07

Choose a tag to compare

Changelog

[0.12.1] - 2024-07-21

🚀 New Features

1. Pointer Dereferencing Support

  • Added pointer dereferencing in PRINT statements: You can now use PRINT *ptr to dereference and print pointer values
  • Added pointer dereferencing in MOV assignments: You can now use MOV dest *ptr to 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 *ptr would cause a semantics error
  • Fixed pointer dereferencing in MOV assignments: Previously, MOV dest *ptr was 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.z file 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

  1. Constants: The CONST keyword still causes recursion issues in the current compiler
  2. Float/Double Types: Missing print_double function in codegen
  3. PRINTSTR: Not implemented in codegen (using PRINT with string literals as workaround)
  4. 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

18 Nov 09:00
3e20ba9

Choose a tag to compare

🎉 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_file and extract_non_main_functions helpers
  • Updated semantics.py _handle_import method 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

15 Nov 21:59

Choose a tag to compare

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

03 Nov 07:10

Choose a tag to compare

Added

  • Pointer Support: Added comprehensive pointer functionality to ZLang
    • Declare pointers using PTR type ptr_name variable syntax
    • Print memory addresses using PRINT ptr
    • Dereference pointers using *ptr in PRINT statements
    • Type safety checks for pointer operations
    • Pointer arithmetic support (e.g., ADD *ptr 90)

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

02 Nov 04:19

Choose a tag to compare

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

29 Oct 20:24
b1d6f3c

Choose a tag to compare

Added safeguards for Overflow and boolean with Capital True and capital False. Fixed boolean declarations. Added the Overflow error, error 45.

Z 0.9

26 Oct 00:53
d11452e

Choose a tag to compare

Fixed READ, removed immutability by default, added CONST for constants, removed dynamic typing(just defaulted to double all the time), fixed -u.