Skip to content

HyperMatrix v1.0.6 ( Lexer & ParserUpdate )

Compare
Choose a tag to compare
@HyperMatrixDev HyperMatrixDev released this 05 Feb 14:45
· 19 commits to main since this release
ac44085

HyperMatrix v1.0.6 Release Notes

Welcome to HyperMatrix v1.0.6! This update introduces major improvements in performance, parsing, lexing, and expands language features for enhanced usability and flexibility.


Core Improvements

Memory Optimization

  • Reduced runtime memory allocation for improved efficiency.
  • Optimized execution to minimize unnecessary resource usage.

Lexer and Parser Overhaul

  • Rebuilt the lexer for better efficiency and flexibility.
  • Rebuilt the parser to enhance usability and support future updates.
  • Prepared the lexer and parser for upcoming syntax settings updates.

New Features & Enhancements

Expanded Numeric Support

  • Added lexing for:
    • Binary numbers (0b100110)
    • Hexadecimal numbers (0xfe14d5)
    • Octal numbers (0o521237)
    • Numbers with exponents (45e+2)

Multi-Word Keywords

  • Introduced flexible keyword combinations:
    • hash tag (both words form a keyword, individually they are not)
    • is not (each is a keyword, but together they form another keyword)
    • is null (the first is a keyword, the second is not, but together they form a new keyword)

Static Initializers

  • Added static initializers for classes, similar to Java:
    class Example {
        static {
            println("Static block initialized");
        }
    }
    
    • Allows initializing static variables multiple times within a class.
    • Executes in the order defined.

Stable Unit Expressions

  • Unit expressions are now stable and out of the experimental phase.
  • Fully supports numeric types:
    45m      // Integer with unit
    5.3cm    // Float with unit
    0b100110turn // Binary number with unit
    

Performance Improvements

  • Optimized switch and if statements by reducing evaluation overhead, increasing speed by 76%.
  • Fixed infinite loop bug caused by unclosed parenthesis (5, now properly throws an error instead.

AST Serialization Support

  • The parser is now ready for AST serialization with .hpr files (High Performance Load format).
  • No need for lexing or parsing .hpr files—direct deserialization enables instant execution.

Extended Escape Character Support

HyperMatrix now supports a vastly expanded escape sequence family:

Standard Escapes

  • \0 → Null character
  • \a → Bell/alert
  • \e → Escape character
  • \n → Newline
  • \t → Tab
  • \v → Vertical tab
  • \r → Carriage return
  • \b → Backspace
  • \f → Form feed
  • \' → Single quote
  • \" → Double quote
  • \\ → Backslash

Unicode & Hexadecimal Support

  • \uXXXX → Unicode character
  • \xXX / \x{XXXX} → Hexadecimal character

Randomized Escapes

  • \?; → Random ASCII character
  • \?{abcde}; → Random character from a set
  • \??? → Three random characters
  • \?{01}?? → Random binary with a specific length

Repetition & Formatting

  • \#Nchar; → Repeat a character N times
  • \#N{text}; → Repeat a string N times
  • \|color|text → Apply text color formatting
  • \|#RRGGBB|text → Custom RGB text color
  • \|##RRGGBB|text → Custom RGB background color
  • \|<| → Return to previous color
  • \|<<| → Reset all colors

Control & Special Characters

  • \cX → Control character escape
  • \M{name} → Maintained Unicode character
  • \N → Auto-incrementing counter
  • \N; → Auto-incrementing counter without placing a value
  • \B{binary} → Binary character representation
  • \C[text] → Rainbow text
  • \D{format} → Date formatting
  • \T{format} → Time formatting

Upcoming Enhancements

  • Further optimizations in the parser and lexer for faster execution.
  • Expanded AST functionality for more efficient deserialization.
  • Additional improvements to static initialization handling.

Thank you for using HyperMatrix! This update brings foundational improvements, making the language more powerful and extensible. Let us know your thoughts and suggestions on our GitHub Issues.