Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Releases: CodeNothingCommunity/CodeNothing-Zero

v0.4.7

26 Jul 21:22

Choose a tag to compare

[v0.4.7] - 2025-07-27

🎯 Major New Feature: Enum Types

Core Features

  • Full enum syntax support

    • Basic enums: enum Color { Red, Green, Blue };
    • Parameterized enums: enum Result { Success(string, int), Error(string) };
    • Complex enums: Supports up to 10 parameters of different types per variant
    • Mixed enums: Different variants can have different parameter structures
  • Type safety guarantees

    • Strict runtime type checking and parameter validation
    • Smart type inference for automatic enum recognition
    • Function parameter and return value enum validation
    • Type safety checks for enum variable assignments
  • Method call support

    • toString(): Get string representation of enum
    • getEnumName(): Get enum type name
    • getVariantName(): Get enum variant name
    • length(): Get number of fields in enum variant
  • String operation integration

    • Support for enum-string concatenation (+ operator)
    • New string methods: startsWith(), endsWith(), contains()
    • Full string comparison and processing support

Syntax Examples

// Basic enum
enum Status { Active, Inactive, Pending };

// Parameterized enum
enum ApiResponse {
    Ok(int, string),
    Error(string),
    NotFound(string)
};

// Enum usage
status : Status = Status::Active;
response : ApiResponse = ApiResponse::Ok(200, "Success");

// Enum methods
statusName : string = status.getVariantName();  // "Active"
responseStr : string = response.toString();     // "ApiResponse::Ok(200, Success)"

Technical Implementation

  • AST Extension: Added Enum, EnumVariant, EnumField structs and expressions
  • Parser Enhancement: New enum_parser.rs module for full enum syntax parsing
  • Interpreter Improvement: Added EnumInstance value type with creation/access logic
  • Type System Integration: Extended type checking for smart enum matching

Test Verification

  • ✅ Basic: Simple enum definition and usage
  • ✅ Complex: JSON processing, HTTP states, game state machines
  • ✅ Performance: 1000+ enum instance creation
  • ✅ Edge Cases: Null values, special chars, long strings
  • ✅ Business Logic: Auth systems, API responses, state transitions

Backward Compatibility

  • ✅ Fully backward compatible with existing code
  • ✅ Seamless integration with classes, interfaces, namespaces
  • ✅ No breaking changes to existing APIs

Known Limitations

  • Negative number literals not supported as enum parameters
  • Pattern matching syntax not yet implemented (planned)
  • Only positional parameters supported (no named fields)

Example Files

  • examples/enum_test.cn - Basic functionality demo
  • examples/enum_complex_test.cn - Complex scenario applications
  • examples/enum_final_test.cn - Comprehensive functionality tests

[v0.4.7] - 2025-07-27

🎯 重大新功能:枚举类型 (Enum Types)

核心特性

  • 完整的枚举语法支持

    • 基础枚举:enum Color { Red, Green, Blue };
    • 带参数枚举:enum Result { Success(string, int), Error(string) };
    • 复杂枚举:支持每个变体最多10个不同类型参数
    • 混合枚举:不同变体可拥有不同的参数结构
  • 类型安全保障

    • 严格的运行时类型检查和参数验证
    • 自动识别枚举类型的智能类型推断
    • 函数参数和返回值的枚举类型验证
    • 枚举变量赋值的类型安全检查
  • 方法调用支持

    • toString():获取枚举的字符串表示
    • getEnumName():获取枚举类型名称
    • getVariantName():获取枚举变体名称
    • length():获取枚举变体字段数量
  • 字符串操作集成

    • 支持枚举与字符串的连接操作(+ 运算符)
    • 新增字符串方法:startsWith(), endsWith(), contains()
    • 完整的字符串比较和处理支持

语法示例

// 基础枚举
enum Status { Active, Inactive, Pending };

// 带参数枚举
enum ApiResponse {
    Ok(int, string),
    Error(string),
    NotFound(string)
};

// 枚举使用
status : Status = Status::Active;
response : ApiResponse = ApiResponse::Ok(200, "成功");

// 枚举方法
statusName : string = status.getVariantName();  // "Active"
responseStr : string = response.toString();     // "ApiResponse::Ok(200, 成功)"

技术实现

  • AST扩展:新增EnumEnumVariantEnumField结构体和相关表达式
  • 解析器增强:新增enum_parser.rs模块支持完整枚举语法
  • 解释器改进:新增EnumInstance值类型实现创建/访问逻辑
  • 类型系统集成:扩展类型检查机制支持智能枚举匹配

测试验证

  • ✅ 基础测试:简单枚举定义和使用
  • ✅ 复杂场景:JSON处理、HTTP状态、游戏状态机
  • ✅ 性能测试:1000+枚举实例创建
  • ✅ 边界情况:空值、特殊字符、长字符串
  • ✅ 业务逻辑:认证系统、API响应、状态转换

向后兼容性

  • ✅ 完全向后兼容现有代码
  • ✅ 与类、接口、命名空间无缝集成
  • ✅ 不破坏现有API和语法结构

已知限制

  • 不支持负数字面量作为枚举参数
  • 暂未实现模式匹配语法(计划中)
  • 仅支持位置参数(不支持命名字段)

示例文件

  • examples/enum_test.cn - 基础功能演示
  • examples/enum_complex_test.cn - 复杂场景应用
  • examples/enum_final_test.cn - 综合功能测试

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.6...v0.4.7

v0.4.6

25 Jul 21:08

Choose a tag to compare

[v0.4.6] - 2025-07-26

🚀 Major New Features

1. Default Parameter Values

Default parameter values allow function parameters to specify default values that are used when arguments are omitted during function calls.

Key Features:

  • Optional parameters: Makes function parameters optional
  • Expression support: Default values can be constants, variables, or complex expressions
  • Improved readability: Makes APIs clearer and reduces boilerplate code
  • Mixed usage: Can be used alongside required parameters

Syntax:

fn function_name(param : type = default_value, ...) : return_type {
    // Function body
}

Examples:

// Simple default parameters
fn greet(name : string = "World", greeting : string = "Hello") : string {
    return `${greeting}, ${name}!`;
};

// Using default values
greet();               // Returns "Hello, World!"
greet("Alice");        // Returns "Hello, Alice!"
greet("Bob", "Hi");    // Returns "Hi, Bob!"

// Expression as default value
fn multiply(a : int, b : int = a * 2) : int {
    return a * b;
};

multiply(5);    // Returns 50 (5 * 10)
multiply(3, 4); // Returns 12 (3 * 4)

2. Raw String Literals

Raw string literals preserve all characters exactly as written, without processing escape sequences.

Key Features:

  • No escaping needed: Special characters like \ remain literal
  • Simplifies complex strings: Ideal for regex, file paths, etc.
  • Preserves special characters: Sequences like \n remain as text
  • Improved readability: Reduces escape clutter in code

Syntax:

r"raw string content"

Examples:

// Regular string (requires escaping)
path1 : string = "C:\\Users\\Documents\\file.txt";

// Raw string (no escaping needed)
path2 : string = r"C:\Users\Documents\file.txt";

// Special characters comparison
normal : string = "Line1\nLine2\tTab";  // Special characters processed
raw : string = r"Line1\nLine2\tTab";    // Special characters preserved

// Regex without double escaping
regex : string = r"\d+\.\d+";

🔧 Technical Implementation

  • Default Parameters:

    • Added default_value field to AST Parameter struct
    • Enhanced function parser to handle = syntax
    • Implemented default value calculation during function calls
  • Raw Strings:

    • Added RawStringLiteral expression type to AST
    • Enhanced lexer to recognize r"..." tokens
    • Modified parser to handle raw string expressions
    • Updated evaluator to preserve raw string contents

🔄 Compatibility

  • Full backward compatibility: Existing code works unchanged
  • Optional usage: Features available but not required
  • String interoperability: Raw and regular strings work together seamlessly
  • Mixed parameters: Default parameters can be combined with required parameters

🔮 Future Plans

  1. Named Parameters:

    createPerson(age: 30, name: "Alice");
    
  2. Rest Parameters:

    fn sum(first: int, ...rest: array<int>) : int { ... }
    
  3. Multiline Raw Strings:

    r"""
    Multiline
    raw string
    """
    
  4. Raw String Interpolation:

    r`Regex: \d+ matches ${number}`
    

[v0.4.6] - 2025-07-26

🚀 重大新功能

1. 默认参数值 (Default Parameter Values)

允许函数参数指定默认值,调用时省略参数将使用默认值。

主要特性:

  • 参数可选性:使函数参数变为可选
  • 表达式支持:默认值可以是常量、变量或复杂表达式
  • 提高可读性:使API更清晰,减少样板代码
  • 混合使用:可与必需参数一起使用

语法:

fn 函数名(参数名 : 类型 = 默认值, ...) : 返回类型 {
    // 函数体
}

示例:

// 简单默认参数
fn greet(name : string = "世界", greeting : string = "你好") : string {
    return `${greeting}, ${name}!`;
};

// 使用默认值调用
greet();               // 返回 "你好, 世界!"
greet("张三");         // 返回 "你好, 张三!"
greet("李四", "您好"); // 返回 "您好, 李四!"

// 表达式作为默认值
fn multiply(a : int, b : int = a * 2) : int {
    return a * b;
};

multiply(5);    // 返回 50 (5 * 10)
multiply(3, 4); // 返回 12 (3 * 4)

2. 原始字符串字面量 (Raw String Literals)

原始字符串保留所有字符原样,不处理转义序列。

主要特性:

  • 无需转义:特殊字符(如\)保持原义
  • 简化复杂字符串:适合正则表达式、文件路径等场景
  • 保留特殊字符\n等序列保持文本形式
  • 提高可读性:减少代码中的转义字符

语法:

r"原始字符串内容"

示例:

// 常规字符串(需要转义)
path1 : string = "C:\\Users\\Documents\\file.txt";

// 原始字符串(无需转义)
path2 : string = r"C:\Users\Documents\file.txt";

// 特殊字符比较
normal : string = "第一行\n第二行\t制表符";  // 特殊字符被处理
raw : string = r"第一行\n第二行\t制表符";    // 特殊字符保持原样

// 正则表达式(无需双重转义)
regex : string = r"\d+\.\d+";

🔧 技术实现

  • 默认参数:

    • AST参数结构体新增default_value字段
    • 增强函数解析器处理=语法
    • 实现函数调用时的默认值计算
  • 原始字符串:

    • AST新增RawStringLiteral表达式类型
    • 增强词法分析器识别r"..."标记
    • 修改解析器处理原始字符串表达式
    • 更新求值器保留原始字符串内容

🔄 兼容性

  • 完全向后兼容:现有代码无需修改
  • 可选使用:功能可用但不强制使用
  • 字符串互操作:原始字符串与常规字符串可互操作
  • 参数混合使用:默认参数可与必需参数混合使用

🔮 未来计划

  1. 命名参数:

    createPerson(age: 30, name: "张三");
    
  2. 剩余参数:

    fn sum(first: int, ...rest: array<int>) : int { ... }
    
  3. 多行原始字符串:

    r"""
    多行
    原始字符串
    """
    
  4. 原始字符串插值:

    r`正则表达式: \d+ 匹配 ${number}`
    

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.5...v0.4.6

v0.4.5

25 Jul 19:57

Choose a tag to compare

CodeNothing String Interpolation Feature - v0.4.5 (2025-07-26)

🚀 Major New Feature: String Interpolation

String interpolation is a powerful feature that allows developers to embed expressions within strings, making string construction more concise, intuitive, and readable.

✨ New Features

1. Template String Syntax

  • Use backticks (`) to define template strings
  • Expression embedding: Use ${...} syntax to embed expressions within strings
  • Multiline strings: Support line breaks and preserve formatting

2. Interpolation Expression Support

  • Variable interpolation: ${name}
  • Expression interpolation: ${a + b}
  • Function call interpolation: ${getTime()}
  • Nested string interpolation: ${inner ${value}}
  • Ternary operator interpolation: ${condition ? "true" : "false"}

🔧 Technical Implementation

AST Extension

// New expression type
Expression::StringInterpolation(Vec<StringInterpolationSegment>)

// String interpolation segment enum
enum StringInterpolationSegment {
    Text(String),                 // Regular text segment
    Expression(Box<Expression>),  // Expression segment
}

Lexer Enhancements

  • Recognize backtick-delimited strings
  • Separate text segments and expression segments
  • Special token processing (INTERP_START, INTERP_TEXT, INTERP_EXPR, INTERP_END)

Parser Enhancements

  • Parse string interpolation expressions
  • Handle nested expressions
  • Expression evaluation

Executor Enhancements

  • Concatenate text segments
  • Evaluate expressions and convert values to strings
  • Handle string conversion for different value types

📝 Syntax Examples

// 1. Simple variable interpolation
name : string = "World";
greeting : string = `Hello, ${name}!`;  // Result: "Hello, World!"

// 2. Expression interpolation
a : int = 5;
b : int = 3;
result : string = `${a} + ${b} = ${a + b}`;  // Result: "5 + 3 = 8"

// 3. Function call interpolation
message : string = `Current time: ${getTimeString()}`;

// 4. Nested interpolation
c : int = 10;
nested : string = `Nested: ${`Inner value: ${c * 2}`}`;  // Result: "Nested: Inner value: 20"

// 5. Conditional interpolation
score : int = 85;
grade : string = `Grade: ${score >= 90 ? "A" : score >= 80 ? "B" : score >= 60 ? "C" : "F"}`;
// Result: "Grade: B"

// 6. Multiline interpolation
multiline : string = `Multiline string
Line 1: ${a}
Line 2: ${b}`;

🔄 Compatibility

  • Fully backward compatible
  • Regular double-quoted strings still available
  • String concatenation (+) operator remains valid

📚 Use Cases

  • Dynamic message construction
  • Template generation
  • Complex string formatting
  • Multi-language support
  • HTML/XML generation

🔮 Future Expansion Plans

1. Formatting Control

Consider adding extended support for string formatting, e.g.:

`${value:fmt}` // Where fmt is a format specifier
`${number:.2f}` // Preserve 2 decimal places

2. Template Engine

Build a more complete template engine based on string interpolation, supporting control structures like conditionals and loops.

3. Raw Strings

Add support for raw strings without special character escaping:

r`Raw string, no escaping of \n etc.`

4. Tagged Templates

Support JavaScript-like tagged template functionality:

html`<div>${content}</div>`

This version brings modern string processing capabilities to CodeNothing, making string operations more concise and expressive while maintaining the language's simplicity and ease of use.

CodeNothing 字符串插值功能 - v0.4.5(2025-07-26)

🚀 重大新功能:字符串插值

字符串插值是一种强大的特性,允许开发者在字符串中嵌入表达式,使字符串构建更加简洁、直观和可读。

✨ 新增功能

1. 模板字符串语法

  • 使用反引号 (`) 定义模板字符串
  • 表达式嵌入:使用 ${...} 语法在字符串中嵌入表达式
  • 多行字符串:支持换行,保留格式

2. 插值表达式支持

  • 变量插值${name}
  • 表达式插值${a + b}
  • 函数调用插值${getTime()}
  • 嵌套字符串插值${内部${value}}
  • 三元运算符插值${condition ? "真" : "假"}

🔧 技术实现

AST扩展

// 新增表达式类型
Expression::StringInterpolation(Vec<StringInterpolationSegment>)

// 字符串插值片段枚举
enum StringInterpolationSegment {
    Text(String),                 // 普通文本片段
    Expression(Box<Expression>),  // 表达式片段
}

词法分析器增强

  • 识别反引号字符串
  • 分离文本片段和表达式片段
  • 特殊标记处理 (INTERP_START, INTERP_TEXT, INTERP_EXPR, INTERP_END)

解析器增强

  • 解析字符串插值表达式
  • 处理嵌套表达式
  • 表达式求值

执行器增强

  • 连接文本片段
  • 计算表达式值并转换为字符串
  • 处理不同类型值的字符串转换

📝 语法示例

// 1. 简单变量插值
name : string = "世界";
greeting : string = `你好,${name}!`;  // 结果: "你好,世界!"

// 2. 表达式插值
a : int = 5;
b : int = 3;
result : string = `${a} + ${b} = ${a + b}`;  // 结果: "5 + 3 = 8"

// 3. 函数调用插值
message : string = `当前时间是:${getTimeString()}`;

// 4. 嵌套插值
c : int = 10;
nested : string = `嵌套插值:${`内部值: ${c * 2}`}`;  // 结果: "嵌套插值:内部值: 20"

// 5. 条件插值
score : int = 85;
grade : string = `等级: ${score >= 90 ? "优秀" : score >= 80 ? "良好" : score >= 60 ? "及格" : "不及格"}`;
// 结果: "等级: 良好"

// 6. 多行插值
multiline : string = `多行字符串
第一行:${a}
第二行:${b}`;

🔄 兼容性

  • 完全向后兼容
  • 常规双引号字符串仍然可用
  • 字符串连接 (+) 操作符仍然有效

📚 使用场景

  • 动态消息构造
  • 模板生成
  • 复杂字符串格式化
  • 多语言支持
  • HTML/XML生成

🔮 未来扩展计划

1. 格式化控制

考虑添加对字符串格式化的扩展支持,例如:

`${value:fmt}` // 其中fmt是格式说明符
`${number:.2f}` // 保留2位小数

2. 模板引擎

基于字符串插值构建更完整的模板引擎,支持条件、循环等控制结构。

3. 原始字符串

添加对不转义特殊字符的原始字符串 (raw string) 支持:

r`原始字符串,不对\n等特殊字符进行转义`

4. 标记模板

支持类似JavaScript标记模板的功能:

html`<div>${content}</div>`

这个版本为CodeNothing带来了现代字符串处理的强大功能,使字符串操作更加简洁、表达力更强,同时保持了语言的简单性和易用性。

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.4...v0.4.5

v0.4.4

25 Jul 15:48

Choose a tag to compare

Here's the bilingual update log with English above Chinese:

[v0.4.4] - 2025-07-25

🐛 Critical Fix: Nested Namespace Resolution

  • Fixed nested namespace syntax parsing: Resolved parsing issues for nested namespace calls like parent::child::add(30, 40)
    • Fixed "expected ';' but got '::'" parsing error
    • Supports arbitrary depth namespace nesting (e.g. level1::level2::level3::function())
    • Improved :: operator handling in expression parser

✨ Feature Enhancements

  • Improved namespace path resolution: Refactored namespace handling in expression parser
    • Optimized multi-level :: operator parsing flow
    • Enhanced recognition accuracy for namespace function calls
    • Supports nested namespace calls in complex expressions

🔧 Technical Improvements

  • Expression parser optimization: Improved parsing logic in src/parser/expression_parser.rs
    • Refactored :: handling in parse_primary_expression method
    • Optimized namespace path construction algorithm
    • Enhanced parser error handling capabilities

📝 Fixed Syntax Support

// These syntaxes can now be correctly parsed and executed
ns parent {
    ns child {
        fn add(a : int, b : int) : int {
            return a + b;
        };
    };
};

fn main() : int {
    // Nested namespace function call
    sum : int = parent::child::add(30, 40);
    
    // Nested namespace import
    using ns parent::child;
    result : int = add(10, 20);
    
    return 0;
};

🎯 Compatibility

  • Fully backward compatible: No impact on existing single-level namespace functionality
  • Test verification: Passed various nested scenario test cases

[v0.4.4] - 2025-07-25

🐛 重要修复:嵌套命名空间解析

  • 修复嵌套命名空间语法解析错误: 解决了 parent::child::add(30, 40) 等嵌套命名空间调用的解析问题
    • 修复了"期望 ';', 但得到了 '::'"的解析错误
    • 支持任意深度的命名空间嵌套(如 level1::level2::level3::function()
    • 完善了表达式解析器中的 :: 操作符处理逻辑

✨ 功能增强

  • 改进命名空间路径解析: 重构了表达式解析器的命名空间处理机制
    • 优化了多层 :: 操作符的解析流程
    • 增强了命名空间函数调用的识别准确性
    • 支持在复杂表达式中使用嵌套命名空间调用

🔧 技术改进

  • 表达式解析器优化: 改进了 src/parser/expression_parser.rs 中的解析逻辑
    • 重构了 parse_primary_expression 方法的 :: 处理部分
    • 优化了命名空间路径构建算法
    • 提升了解析器的错误处理能力

📝 修复的语法支持

// 现在这些语法都能正确解析和执行
ns parent {
    ns child {
        fn add(a : int, b : int) : int {
            return a + b;
        };
    };
};

fn main() : int {
    // 嵌套命名空间函数调用
    sum : int = parent::child::add(30, 40);
    
    // 嵌套命名空间导入
    using ns parent::child;
    result : int = add(10, 20);
    
    return 0;
};

🎯 兼容性

  • 完全向后兼容: 不影响现有的单层命名空间功能
  • 测试验证: 通过了多种嵌套场景的测试用例

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.3...v0.4.4

v0.4.3

24 Jul 17:18

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.4.3 Changelog

[v0.4.3] - 2025-07-25

🚀 Major Feature: Switch Pattern Matching Expansion

  • Range Matching: Added case 1..10 syntax
    • Integer ranges: case 1..100
    • Float ranges: case 0.0..1.0
    • Mixed-type range comparisons
  • Guard Conditions: Added case x if condition syntax
    • Variable binding: case x if x > 0
    • Complex conditions: case x if x % 2 == 0 && x < 100
    • Dynamic condition evaluation
  • Switch Expressions: Added value-returning switch expressions
    • Expression syntax: case value => expression
    • Auto-break mechanism
    • Fully compatible with existing statement form

✨ Syntax Enhancements

  • Pattern Matching System: New CasePattern enum supporting multiple patterns
    • Value(Expression): Traditional value matching
    • Range(start, end): Range matching
    • Guard(var, condition): Guard condition matching
    • Destructure(pattern): Destructuring matching (reserved interface)
  • Mixed Syntax Support: Different patterns can be mixed in single switch
  • Type Safety: Strong type checking ensures pattern consistency

🔧 Technical Implementation

  • AST Extension: Added CasePattern, SwitchType, DestructurePattern
  • Parser Enhancement: Intelligent pattern recognition
    • Auto-detection of range operator ..
    • Guard condition if keyword recognition
    • Expression form => operator support
  • Interpreter Optimization: Efficient pattern matching algorithm
    • Range check optimization
    • Guard condition variable binding
    • Expression evaluation caching

📝 Syntax Examples

// Range matching  
switch (score) {  
    case 90..100 => "Excellent",  
    case 80..89 => "Good",  
    default => "Needs improvement"  
};  

// Guard conditions  
switch (value) {  
    case x if x % 2 == 0 => "Even",  
    case x if x > 100 => "Large number",  
    default => "Other"  
};  

// Switch expression (reserved feature)  
grade : string = switch (score) {  
    case 90..100 => "A",  
    case 80..89 => "B",  
    default => "F"  
};  

🎯 Compatibility

  • Fully Backward Compatible: Existing switch statements unchanged
  • Gradual Adoption: New features can be adopted progressively
  • Performance Optimized: No impact on existing code performance

🧪 Test Coverage

  • Basic Tests: Core pattern matching verification
  • Complex Tests: Nested/mixed patterns and edge cases
  • Practical Tests: Real-world scenario simulations

🔧 Critical Fix: using file Statement Optimization

  • Smart Preprocessing: Complete file import mechanism redesign

    • Recursive import support
    • Intelligent path resolution
    • Cycle detection
    • File caching optimization
  • Preprocessing Stage Handling: Major architectural improvement

    • Direct file content merging
    • Zero runtime overhead
    • Clear import markers
    • Simplified AST
  • Enhanced Error Handling: Better developer experience

    • Detailed error messages
    • Early error detection
    • Clear cycle import warnings
  • Seamless Switch Integration:

    // patterns.cn  
    fn isEven(x : int) : bool { return x % 2 == 0; }  
    const SMALL_RANGE : int = 10;  
    
    // main.cn  
    using file "patterns.cn";  
    switch (value) {  
        case 1..SMALL_RANGE => "Small range",  
        case x if isEven(x) => "Even",  
        default => "Other"  
    }  
    

🚀 Modular Development Support

  • Pattern Libraries: Reusable pattern matching libraries
  • Constant Library Import: Constants for range matching
  • Function Library Integration: Guard conditions using imported functions
  • Large Project Support: Modular development capabilities

📈 Performance Optimization

  • Preprocessing Optimization: File imports handled at compile-time
  • Smart Caching: Files processed only once
  • Memory Optimization: Reduced runtime memory usage

🔧 Critical Fix: Relative Path Resolution


CodeNothing 编程语言解释器 v0.4.3 更新日志

[v0.4.3] - 2025-07-25

🚀 重大新功能:Switch 模式匹配扩展

  • 范围匹配支持: 新增 case 1..10 语法
    • 整数范围: case 1..100
    • 浮点数范围: case 0.0..1.0
    • 混合类型范围比较
  • Guard 条件支持: 新增 case x if condition 语法
    • 变量绑定: case x if x > 0
    • 复杂条件: case x if x % 2 == 0 && x < 100
    • 动态条件判断
  • Switch 表达式支持: 新增返回值的 switch 表达式
    • 表达式语法: case value => expression
    • 自动 break 机制
    • 完全兼容现有语句形式

✨ 语法增强

  • 模式匹配系统: 全新 CasePattern 枚举支持多种模式
    • Value(Expression): 传统值匹配
    • Range(start, end): 范围匹配
    • Guard(var, condition): Guard 条件匹配
    • Destructure(pattern): 解构匹配(预留接口)
  • 混合语法支持: 同一 switch 支持不同模式混用
  • 类型安全: 强类型检查确保模式一致性

🔧 技术实现

  • AST 扩展: 新增 CasePatternSwitchTypeDestructurePattern
  • 解析器增强: 智能模式识别
    • 自动检测范围操作符 ..
    • Guard 条件 if 关键字识别
    • 表达式形式 => 操作符支持
  • 解释器优化: 高效模式匹配算法
    • 范围检查优化
    • Guard 条件变量绑定
    • 表达式求值缓存

📝 语法示例

// 范围匹配  
switch (score) {  
    case 90..100 => "优秀",  
    case 80..89 => "良好",  
    default => "需努力"  
};  

// Guard 条件  
switch (value) {  
    case x if x % 2 == 0 => "偶数",  
    case x if x > 100 => "大数",  
    default => "其他"  
};  

// Switch 表达式(预留功能)  
grade : string = switch (score) {  
    case 90..100 => "A",  
    case 80..89 => "B",  
    default => "F"  
};  

🎯 兼容性

  • 完全向后兼容: 现有 switch 语句无需修改
  • 渐进式采用: 可逐步引入新特性
  • 性能优化: 不影响现有代码性能

🧪 测试覆盖

  • 基础测试: 核心模式匹配验证
  • 复杂测试: 嵌套/混合模式及边界条件
  • 实际测试: 真实场景模拟

🔧 重大修复:using file 语句优化

  • 智能预处理系统: 文件导入机制重构

    • 递归导入支持
    • 智能路径解析
    • 循环检测
    • 文件缓存优化
  • 预处理阶段处理: 重大架构改进

    • 直接文件内容合并
    • 零运行时开销
    • 清晰导入标记
    • AST 简化
  • 错误处理增强: 更好开发体验

    • 详细错误信息
    • 提前错误检测
    • 明确循环导入警告
  • 无缝 Switch 集成:

    // patterns.cn  
    fn isEven(x : int) : bool { return x % 2 == 0; }  
    const SMALL_RANGE : int = 10;  
    
    // main.cn  
    using file "patterns.cn";  
    switch (value) {  
        case 1..SMALL_RANGE => "小范围",  
        case x if isEven(x) => "偶数",  
        default => "其他"  
    }  
    

🚀 模块化开发支持

  • 模式库系统: 可重用模式匹配库
  • 常量库导入: 范围匹配用常量
  • 函数库集成: Guard 条件使用导入函数
  • 大型项目支持: 模块化开发能力

📈 性能优化

  • 预处理优化: 文件导入编译时完成
  • 智能缓存: 文件仅处理一次
  • 内存优化: 降低运行时内存占用

🔧 重大修复:相对路径解析问题修复

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.2...v0.4.3

v0.4.2

24 Jul 14:12

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.4.2 Changelog

[v0.4.2] - 2025-07-24

🚀 Major New Feature

  • Lambda Expression Support: Added complete lambda expressions and functional programming capabilities
    • Single-parameter lambda: x => x * 2
    • Multi-parameter lambda: (x, y) => x + y
    • Lambda block: (x) => { statements }
    • Function type: fn(int, int) -> int

✨ Functional Programming Features

  • Higher-Order Functions: Support for array.map(), array.filter(), array.reduce(), array.forEach()
  • Function Value Reference: Functions can be passed and called as values
  • Type Inference: Lambda parameters support auto type inference
  • Chaining Operations: Support for functional programming chaining style

🔧 Technical Implementation

  • AST Extension: Added Lambda, LambdaBlock, FunctionValue expression types
  • Type System: Added Type::Function type support
  • Value System: Added Lambda, LambdaBlock, FunctionReference value types
  • Lexical Analysis: Added => operator support
  • Parser: Smart lambda parameter list detection and parsing
  • Interpreter: Complete lambda execution environment and function application mechanism

📝 Syntax Examples

// Basic lambda expressions  
double : fn(int) -> int = x => x * 2;  
add : fn(int, int) -> int = (x, y) => x + y;  

// Array functional programming  
numbers : array<int> = [1, 2, 3, 4, 5];  
evens : array<int> = numbers.filter(x => x % 2 == 0);  
squares : array<int> = numbers.map(x => x * x);  
sum : int = numbers.reduce((acc, x) => acc + x, 0);  

// Higher-order functions  
fn processArray(arr : array<int>, processor : fn(int) -> int) : array<int> {  
    return arr.map(processor);  
}  

🎯 Compatibility

  • Fully Backward Compatible: No impact on existing code
  • Gradual Adoption: Lambdas can be introduced progressively
  • Type Safety: Perfect integration with existing type system

CodeNothing 编程语言解释器 v0.4.2 更新日志

[v0.4.2] - 2025-07-24

🚀 重大新功能

  • Lambda表达式支持: 添加完整的Lambda表达式和函数式编程功能
    • 单参数Lambda: x => x * 2
    • 多参数Lambda: (x, y) => x + y
    • Lambda块: (x) => { statements }
    • 函数类型: fn(int, int) -> int

✨ 函数式编程特性

  • 高阶函数: 支持array.map()、array.filter()、array.reduce()、array.forEach()
  • 函数值引用: 支持将函数作为值传递和调用
  • 类型推断: Lambda参数支持auto类型推断
  • 链式操作: 支持函数式编程的链式调用风格

🔧 技术实现

  • AST扩展: 新增Lambda、LambdaBlock、FunctionValue等表达式类型
  • 类型系统: 新增Type::Function函数类型支持
  • Value系统: 新增Lambda、LambdaBlock、FunctionReference值类型
  • 词法分析: 新增=>操作符支持
  • 解析器: 智能Lambda参数列表检测和解析
  • 解释器: 完整的Lambda执行环境和函数应用机制

📝 语法示例

// 基础Lambda表达式  
double : fn(int) -> int = x => x * 2;  
add : fn(int, int) -> int = (x, y) => x + y;  

// 数组函数式编程  
numbers : array<int> = [1, 2, 3, 4, 5];  
evens : array<int> = numbers.filter(x => x % 2 == 0);  
squares : array<int> = numbers.map(x => x * x);  
sum : int = numbers.reduce((acc, x) => acc + x, 0);  

// 高阶函数  
fn processArray(arr : array<int>, processor : fn(int) -> int) : array<int> {  
    return arr.map(processor);  
}  

🎯 兼容性

  • 完全向后兼容: 不影响现有代码
  • 渐进式采用: 可以逐步引入Lambda表达式
  • 类型安全: 与现有类型系统完美集成

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.1...v0.4.2

v0.4.1

23 Jul 22:46

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.4.1 Changelog

[v0.4.1] - 2025-07-24

New Features

✨ Strong Type System

  • Implemented strict type checking for variables
  • Added auto type support for weakly-typed variables (e.g. variable : auto = value)
  • Type matching check during variable declaration
  • Type constraint check during variable assignment
  • Maintained strong type checking for constants
  • Supports mixed type system: strong + weak typing options

Type System Features

  • 🔒 Strongly-Typed Variables: intVar : int = 42 - Type-safe, only accepts same-type assignments
  • 🔄 Auto Type: autoVar : auto = value - Weakly-typed, accepts any type assignments
  • Type Checking: Real-time type validation during declaration and assignment
  • 📝 Clear Errors: Detailed type mismatch error messages

Technical Improvements

  • 🔧 Extended AST with Type::Auto type
  • 🔧 Enhanced parser to support auto keyword
  • 🔧 Added variable type storage mechanism in interpreter
  • 🔧 Implemented type constraint checking for variable assignments

CodeNothing 编程语言解释器 v0.4.1 更新日志

[v0.4.1] - 2025-07-24

新增功能

✨ 强类型系统

  • 实现变量强类型检查
  • 新增 auto 类型支持弱类型变量 (如 variable : auto = value)
  • 变量声明时进行类型匹配检查
  • 变量赋值时进行类型约束检查
  • 保持常量的强类型检查机制
  • 支持混合类型系统:强类型 + 弱类型选择

类型系统特性

  • 🔒 强类型变量: intVar : int = 42 - 类型安全,只能赋值相同类型
  • 🔄 Auto 类型: autoVar : auto = value - 弱类型,可以赋值任意类型
  • 类型检查: 变量声明和赋值时的实时类型验证
  • 📝 清晰错误: 详细的类型不匹配错误信息

技术改进

  • 🔧 扩展 AST 添加 Type::Auto 类型
  • 🔧 增强解析器支持 auto 关键字
  • 🔧 在解释器中添加变量类型存储机制
  • 🔧 实现变量赋值的类型约束检查

Installation Guide

Download Steps

  1. Download the following two packages for your operating system:
    • Interpreter main package (codenothing-{OS}.zip
    • Standard library package (codenothing-all-libraries-{OS}-latest.tar.gz

Installation Steps

  1. Extract both packages
  2. Create a subfolder named library in the interpreter's main directory
  3. Copy all extracted library files (.dll or .so) into the newly created library folder

Usage

After completing the above steps, you can start using the CodeNothing programming language interpreter.

System Requirements

  • Windows/Linux operating system
  • Appropriate file extraction tools

安装指南

下载步骤

  1. 下载适用于您操作系统的以下两个压缩包:
    • 解释器本体压缩包(codenothing-{OS}.zip
    • 标准库(library)压缩包(codenothing-all-libraries-{OS}-latest.tar.gz

安装步骤

  1. 解压两个压缩包
  2. 在解释器本体文件夹中创建子文件夹:library
  3. 将解压出的 library 文件(.dll 或 .so)全部复制到新建的 library 文件夹中

使用说明

完成上述步骤后,您就可以开始使用 CodeNothing 编程语言解释器了。

系统要求

  • Windows/Linux 操作系统
  • 适当的文件解压工具

Full Changelog: CodeNothingCommunity/CodeNothing@v0.4.0...v0.4.1

v0.4.0

23 Jul 21:57

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.4.0 Changelog

🎉 Major Feature Update: Switch Statement Support

📋 Version Information

  • Version: v0.4.0
  • Release Date: 2025-07-24
  • Update Type: Major Feature Update

🚀 New Features

✨ Full Switch Statement Implementation

CodeNothing now fully supports Switch statements, providing powerful multi-branch control flow capabilities.

🔧 Core Features

  1. Complete Syntax Support

    switch (expression) {  
        case value1 {  
            // Statements  
            break;  
        };  
        case value2 {  
            // Statements  
            // Supports fall-through  
        };  
        default {  
            // Default handler  
        };  
    };  
    
  2. Multi-Datatype Support

    • int type matching
    • string type matching
    • bool type matching
    • float type matching
    • long type matching
  3. Advanced Control Flow

    • Break statements: Correctly exit switch block
    • Fall-through behavior: Continue to next case without break
    • Default block: Handle unmatched cases
    • Nested switches: Switch inside switch
  4. Seamless Language Integration

    • ✅ Works within functions
    • ✅ Supports namespaces
    • ✅ Compatible with loops
    • ✅ Works with exception handling
    • ✅ Supports variables and constants

🔧 Technical Implementation

AST Extensions

  • Added Statement::Switch statement type
  • Added SwitchCase struct
  • Support for expression matching, statement blocks, and optional default blocks

Parser Enhancements

  • Implemented full switch syntax parsing in statement_parser.rs
  • Support for switch, case, default, break keywords
  • Automatic break statement and fall-through behavior detection

Execution Optimizations

  • Implemented switch execution logic in statement_executor.rs
  • Precise value matching algorithm
  • Correct control flow handling (break, fall-through, default)

🐛 Bug Fixes

🔧 Variable Handling Resolution

  • Issue: JIT compilation system had bugs causing variable assignment/read errors
  • Impact: Affected all variable-dependent operations (including switch matching)
  • Solution: Temporarily disabled problematic JIT compilation
  • Result: Variable assignment, reading, and comparison now fully functional

📖 Usage Examples

Basic Switch Statement

using lib <io>;  

fn main() : int {  
    choice : int = 2;  
    
    switch (choice) {  
        case 1 {  
            std::println("Selected option 1");  
            break;  
        };  
        case 2 {  
            std::println("Selected option 2");  
            break;  
        };  
        case 3 {  
            std::println("Selected option 3");  
            break;  
        };  
        default {  
            std::println("Invalid selection");  
        };  
    };  
    
    return 0;  
};  

String Switch

status : string = "success";  

switch (status) {  
    case "success" {  
        std::println("Operation succeeded");  
        break;  
    };  
    case "error" {  
        std::println("Operation failed");  
        break;  
    };  
    case "warning" {  
        std::println("Warning detected");  
        break;  
    };  
    default {  
        std::println("Unknown status");  
    };  
};  

Fall-through Example

value : int = 1;  

switch (value) {  
    case 1 {  
        std::println("Executing Case 1");  
        // No break → fall through  
    };  
    case 2 {  
        std::println("Executing Case 2 (may come from fall-through)");  
        break;  
    };  
    case 3 {  
        std::println("This won't execute");  
        break;  
    };  
};  

Nested Switch

category : int = 1;  
subcategory : int = 2;  

switch (category) {  
    case 1 {  
        std::println("Electronics category");  
        
        switch (subcategory) {  
            case 1 {  
                std::println("Phones");  
                break;  
            };  
            case 2 {  
                std::println("Computers");  
                break;  
            };  
            default {  
                std::println("Other electronics");  
            };  
        };  
        break;  
    };  
    case 2 {  
        std::println("Clothing category");  
        break;  
    };  
    default {  
        std::println("Unknown category");  
    };  
};  

📁 Sample Files

Complete examples included in project:

  • switch_simple_demo.cn: All switch features demonstration
  • switch_complex_example.cn: Complex usage scenarios

🔄 Compatibility

Backward Compatibility

  • ✅ Fully compatible with existing code
  • ✅ No impact on existing language features
  • ✅ Zero modifications required for existing projects

Language Integration

  • ✅ Works seamlessly with functions, namespaces, classes
  • ✅ Supports usage within loops and conditionals
  • ✅ Compatible with exception handling mechanisms

🎯 Performance Optimizations

Execution Efficiency

  • ✅ High-performance value matching algorithm
  • ✅ Optimized control flow processing
  • ✅ Minimal memory allocation

Compilation Optimizations

  • ✅ Fast syntax parsing
  • ✅ Optimized AST structure
  • ✅ Efficient code generation

🔮 Future Plans

Upcoming Features

  • 🔄 Reactivate and fix JIT compilation system
  • 🔄 Pattern matching extensions for switch
  • 🔄 Range matching support (e.g., case 1..10)
  • 🔄 Guard condition support (case when condition)

Long-Term Roadmap

  • 🔄 Switch expressions (returning values)
  • 🔄 Destructuring support
  • 🔄 Additional datatype support

🎉 重大功能更新:Switch 语句支持

📋 版本信息

  • 版本号: v0.4.0
  • 发布日期: 2025-07-24
  • 更新类型: 重大功能更新

🚀 新增功能

✨ Switch 语句完整实现

CodeNothing 语言现在完全支持 Switch 语句,提供强大的多分支控制流功能。

🔧 核心特性

  1. 完整的语法支持

    switch (expression) {
        case value1 {
            // 语句块
            break;
        };
        case value2 {
            // 语句块
            // 支持 fall-through
        };
        default {
            // 默认处理
        };
    };
    
  2. 多数据类型支持

    • int 类型匹配
    • string 类型匹配
    • bool 类型匹配
    • float 类型匹配
    • long 类型匹配
  3. 高级控制流特性

    • Break 语句: 正确跳出 switch 块
    • Fall-through 行为: 没有 break 时继续执行下一个 case
    • Default 块: 处理无匹配的情况
    • 嵌套 Switch: 支持 switch 内嵌套 switch
  4. 与现有语言特性完美集成

    • ✅ 函数内使用
    • ✅ 命名空间集成
    • ✅ 循环结构配合
    • ✅ 异常处理兼容
    • ✅ 变量和常量支持

🔧 技术实现

AST 扩展

  • 新增 Statement::Switch 语句类型
  • 新增 SwitchCase 结构体
  • 支持表达式匹配、语句块和可选 default 块

解析器增强

  • statement_parser.rs 中实现完整的 switch 语法解析
  • 支持 switch, case, default, break 关键字
  • 自动检测 break 语句和 fall-through 行为

执行器优化

  • statement_executor.rs 中实现 switch 执行逻辑
  • 精确的值匹配算法
  • 正确的控制流处理(break, fall-through, default)

🐛 Bug 修复

🔧 解决变量处理问题

  • 问题: JIT 编译系统在处理变量时存在 bug,导致变量赋值和读取错误
  • 影响: 影响所有依赖变量值的操作,包括 switch 语句的值匹配
  • 解决方案: 暂时禁用有问题的 JIT 编译,确保变量处理的正确性
  • 结果: 变量赋值、读取和比较现在完全正常工作

📖 使用示例

基本 Switch 语句

using lib <io>;

fn main() : int {
    choice : int = 2;
    
    switch (choice) {
        case 1 {
            std::println("选择了选项 1");
            break;
        };
        case 2 {
            std::println("选择了选项 2");
            break;
        };
        case 3 {
            std::println("选择了选项 3");
            break;
        };
        default {
            std::println("无效选择");
        };
    };
    
    return 0;
};

字符串 Switch

status : string = "success";

switch (status) {
    case "success" {
        std::println("操作成功");
        break;
    };
    case "error" {
        std::println("操作失败");
        break;
    };
    case "warning" {
        std::println("警告信息");
        break;
    };
    default {
        std::println("未知状态");
    };
};

Fall-through 示例

value : int = 1;

switch (value) {
    case 1 {
        std::println("执行 Case 1");
        // 没有 break,继续执行下一个 case
    };
    case 2 {
        std::println("执行 Case 2 (可能来自 fall-through)");
        break;
    };
    case 3 {
        std::println("这个不会被执行");
        break;
    };
};

嵌套 Switch

category : int = 1;
subcategory : int = 2;

switch (category) {
    case 1 {
        std::println("电子产品类别");
        
        switch (subcategory) {
            case 1 {
                std::println("手机");
                break;
            };
            case 2 {
                std::println("电脑");
                break;
            };
            default {
                std::println("其他电子产品");
            };
        };
        break;
    };
    case 2 {
        std::println("服装类别");
        break;
    };
    default {
        std::println("未知类别");
    };
};

📁 示例文件

项目中提供了完整的示例文件:

  • switch_simple_demo.cn: 包含所有 Switch 功能的演示
  • switch_complex_example.cn: 复杂使用场景示例

🔄 兼容性

向后兼容

  • ✅ 完全向后兼容现有代码
  • ✅ 不影响现有语言特性
  • ✅ 现有项目无需修改

语言集成

  • ✅ 与函数、命名空间、类等特性完美配合
  • ✅ 支持在循环、条件语句中使用
  • ✅ 异常处理机制兼容

🎯 性能优化

执行效率

  • ✅ 高效的值匹配算法
  • ✅ 优化的控制流处理
  • ✅ 最小化内存分配

编译优化

  • ✅ 快速的语法解析
  • ✅ 优化的 AST 结构
  • ✅ 高效的代码生成

🔮 未来计划

即将推出的功能

  • 🔄 重新启用并修复 JIT 编译系统
  • 🔄 Switch 语句的模式匹配扩展
  • 🔄 范围匹配...
Read more

v0.3.12

23 Jul 11:48

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.3.12 Changelog

[v0.3.12] - 2025-07-23

🔧 Critical Fix - Namespace & Class Static Access Syntax Conflict

Issue Description

After implementing full OOP in v0.3.11, a critical syntax conflict was discovered: the static access syntax ClassName::member used the same :: operator as namespace access namespace::function, causing namespace function calls to fail.

Major Fixes

  • ✅ Fully Resolved Syntax Conflict - Fixed :: operator conflict between namespace and static access
  • ✅ Restored Namespace Access - std::println(), math::add(), test::function() etc. work normally
  • ✅ Maintained Static Access - ClassName::staticMember and ClassName::staticMethod() continue working
  • ✅ Smart Recognition - Runtime auto-distinguishes namespace calls vs static access
  • ✅ Zero Breaking Changes - Fully backward compatible

Technical Implementation

  • Enhanced Expression Evaluator - Added library namespace checks in StaticMethodCall handling
  • Smart Conversion - Auto-converts misidentified static calls to namespace calls
  • Runtime Differentiation - Uses library_namespaces check to intelligently parse syntax
  • Improved Error Handling - Clearer error messages and debug output

Before/After Comparison

// ❌ v0.3.11 - Syntax conflict caused errors  
std::println("test");     // Error: Class 'std' not found  
math::add(1,2);          // Error: Class 'math' not found  
lib_io::read_file();     // Error: Class 'lib_io' not found  

// ✅ v0.3.12 - Fully functional  
std::println("test");     // ✅ Normal output  
math::add(1,2);          // ✅ Normal namespace call  
lib_io::read_file();     // ✅ Normal library call  

// ✅ Static access remains intact  
MathUtils::PI;           // ✅ Static field access  
Calculator::add(1,2);    // ✅ Static method call  

System Stability Improvements

  • Restored Namespace System - Library functions and custom namespaces work normally
  • Preserved OOP System - Static member access unaffected
  • Achieved Syntax Consistency - :: operator now intelligently handled without ambiguity
  • Enterprise-Grade Stability - Language system now production-ready

This is a critical stability release ensuring CodeNothing's completeness and usability as a modern programming language.


CodeNothing 编程语言解释器 v0.3.12 更新日志

[v0.3.12] - 2025-07-23

🔧 重大修复 - 命名空间与类静态访问语法冲突

问题描述

在v0.3.11实现完整OOP系统后,发现严重语法冲突:静态访问语法 ClassName::member 与命名空间访问 namespace::function 使用相同的 :: 操作符,导致命名空间函数调用失败。

重大修复

  • ✅ 完全解决语法冲突 - 修复 :: 操作符在命名空间和静态访问间的冲突
  • ✅ 恢复命名空间访问 - std::println()math::add()test::function() 等调用恢复正常
  • ✅ 保持静态访问 - ClassName::staticMemberClassName::staticMethod() 继续正常工作
  • ✅ 智能识别机制 - 运行时自动区分命名空间调用和静态访问
  • ✅ 零破坏性修复 - 完全向后兼容

技术实现

  • 表达式求值器增强 - 在 StaticMethodCall 处理中添加库命名空间检查
  • 智能转换机制 - 自动将误判的静态调用转为命名空间调用
  • 运行时区分 - 通过 library_namespaces 检查智能解析语法
  • 错误处理优化 - 提供更清晰的错误信息和调试输出

修复前后对比

// ❌ v0.3.11 - 语法冲突导致错误  
std::println("test");     // 错误: 未找到类 'std'  
math::add(1,2);          // 错误: 未找到类 'math'  
lib_io::read_file();     // 错误: 未找到类 'lib_io'  

// ✅ v0.3.12 - 完全正常  
std::println("test");     // ✅ 正常输出  
math::add(1,2);          // ✅ 正常命名空间调用  
lib_io::read_file();     // ✅ 正常库函数调用  

// ✅ 静态访问保持正常  
MathUtils::PI;           // ✅ 静态字段访问  
Calculator::add(1,2);    // ✅ 静态方法调用  

系统稳定性提升

  • 命名空间系统完全恢复 - 库函数和自定义命名空间调用正常
  • OOP系统完整保留 - 静态成员访问不受影响
  • 语法一致性达成 - :: 操作符现在智能处理无歧义
  • 企业级稳定性 - 语言系统达到生产就绪标准

这是一个关键稳定性版本,确保了CodeNothing作为现代编程语言的完整性和可用性。

Installation Guide

Download Steps

  1. Download the following two packages for your operating system:
    • Interpreter main package (codenothing-{OS}.zip
    • Standard library package (codenothing-all-libraries-{OS}-latest.tar.gz

Installation Steps

  1. Extract both packages
  2. Create a subfolder named library in the interpreter's main directory
  3. Copy all extracted library files (.dll or .so) into the newly created library folder

Usage

After completing the above steps, you can start using the CodeNothing programming language interpreter.

System Requirements

  • Windows/Linux operating system
  • Appropriate file extraction tools

安装指南

下载步骤

  1. 下载适用于您操作系统的以下两个压缩包:
    • 解释器本体压缩包(codenothing-{OS}.zip
    • 标准库(library)压缩包(codenothing-all-libraries-{OS}-latest.tar.gz

安装步骤

  1. 解压两个压缩包
  2. 在解释器本体文件夹中创建子文件夹:library
  3. 将解压出的 library 文件(.dll 或 .so)全部复制到新建的 library 文件夹中

使用说明

完成上述步骤后,您就可以开始使用 CodeNothing 编程语言解释器了。

系统要求

  • Windows/Linux 操作系统
  • 适当的文件解压工具

Full Changelog: CodeNothingCommunity/CodeNothing@v0.3.11...v0.3.12

v0.3.11

23 Jul 09:54

Choose a tag to compare

CodeNothing Programming Language Interpreter v0.3.11 Changelog

🎯 Version Information

  • Version: 0.3.11
  • Release Date: 2025-07-23
  • Feature Type: OOP Final Piece - Interface System
  • Impact Scope: Complete Modern OOP Framework

🚀 Major Achievement

OOP Final Piece Completed - CodeNothing now features a complete modern object-oriented programming framework including classes, inheritance, abstract classes, static members, and an interface system!


✅ New Core Features

1. Comprehensive Interface System

Feature: Full support for interface definition and implementation
Implementation:

  • Interface declaration syntax: interface InterfaceName { ... }
  • Interface method declaration: fn methodName(params) : returnType;
  • Interface inheritance: interface Child extends Parent1, Parent2 { ... }
  • Class interface implementation: class MyClass implements Interface1, Interface2 { ... }
// Basic interface definition  
interface Drawable {  
    fn draw() : void;  
    fn getArea() : float;  
};  

// Interface inheritance  
interface Colorable extends Drawable {  
    fn setColor(color : string) : void;  
    fn getColor() : string;  
};  

// Class implementing interface  
class Circle implements Drawable {  
    public fn draw() : void { ... };  
    public fn getArea() : float { ... };  
};  

// Multiple interface implementation  
class ColoredRectangle implements Drawable, Colorable {  
    // Implements all interface methods  
};  

2. Interface Inheritance System

Feature: Interfaces can inherit from multiple parent interfaces
Syntax: interface Child extends Parent1, Parent2, Parent3
Characteristics:

  • Supports multiple interface inheritance
  • Child interfaces inherit all parent methods
  • Complete interface inheritance chain parsing

3. Class Interface Implementation

Feature: Classes can implement multiple interfaces
Syntax: class MyClass implements Interface1, Interface2
Characteristics:

  • Supports multi-interface implementation
  • Classes must implement all interface methods
  • Fully compatible with class inheritance

4. Interface Method Declaration

Feature: Interface methods contain declarations only, no implementation
Syntax: fn methodName(params) : returnType;
Characteristics:

  • Supports access modifiers (default: public)
  • Supports parameter lists and return types
  • Declaration-only, no method bodies

🔧 Technical Implementation Details

New AST Nodes

// Interface structure  
pub struct Interface {  
    pub name: String,  
    pub methods: Vec<InterfaceMethod>,  
    pub extends: Vec<String>, // Inherited interfaces  
}  

// Interface method structure  
pub struct InterfaceMethod {  
    pub name: String,  
    pub parameters: Vec<Parameter>,  
    pub return_type: Type,  
    pub visibility: Visibility,  
}  

// Enhanced class structure  
pub struct Class {  
    pub name: String,  
    pub super_class: Option<String>,  
    pub implements: Vec<String>, // Implemented interfaces  
    // ... other fields  
}  

// Enhanced statement type  
Statement::InterfaceDeclaration(Interface) // Interface declaration  

Parser Implementation

  1. Interface Parser (interface_parser.rs)

    • Complete interface syntax parsing
    • Interface inheritance parsing
    • Interface method declaration parsing
  2. Enhanced Class Parser (class_parser.rs)

    • Added implements syntax support
    • Multi-interface implementation parsing support
  3. Enhanced Program Parser (program_parser.rs)

    • Added interface declaration recognition
    • Interface error collection and handling
  4. Enhanced Statement Executor (statement_executor.rs)

    • Added interface declaration processing

Syntax Support

// Interface definition syntax  
interface InterfaceName {  
    [visibility] fn methodName(param1 : type1, param2 : type2) : returnType;  
    // More method declarations...  
};  

// Interface inheritance syntax  
interface Child extends Parent1, Parent2 {  
    // Child interface methods...  
};  

// Class interface implementation syntax  
class ClassName implements Interface1, Interface2 {  
    // Must implement all interface methods  
};  

// Combined inheritance and interface syntax  
class MyClass extends BaseClass implements Interface1, Interface2 {  
    // Inherits from class while implementing interfaces  
};  

📊 Complete OOP Framework

Complete OOP Features Supported by CodeNothing:

Core OOP

  • Classes and objects
  • Constructors
  • Fields and methods
  • Access modifiers (public/private/protected)

Inheritance and Polymorphism

  • Class inheritance (extends)
  • Method overriding (override)
  • Virtual methods (virtual)
  • Abstract classes and methods

Static Members

  • Static fields and methods
  • Static access syntax (ClassName::member)
  • Static field assignment
  • Complex static operations

Interface System 🆕

  • Interface definition and declaration
  • Interface inheritance (multiple inheritance)
  • Class interface implementation (multi-implementation)
  • Interface method declaration

Comparison with Mainstream Languages

CodeNothing now offers OOP capabilities comparable to:

Feature Java C# C++ CodeNothing
Classes & Objects
Inheritance
Abstract Classes
Interfaces
Multi-Interface Implementation
Static Members
Access Control

🎯 Usage Example

Complete Modern OOP Demo

using lib <io>;  

// Base interface  
interface Drawable {  
    fn draw() : void;  
    fn getArea() : float;  
};  

// Extended interface  
interface Colorable extends Drawable {  
    fn setColor(color : string) : void;  
    fn getColor() : string;  
};  

// Abstract base class  
abstract class Shape implements Drawable {  
    protected name : string;  
    
    constructor(name : string) {  
        this.name = name;  
    };  
    
    // Abstract methods  
    abstract fn draw() : void;  
    abstract fn getArea() : float;  
    
    // Concrete method  
    public fn getName() : string {  
        return this.name;  
    };  
};  

// Concrete implementation class  
class ColoredCircle extends Shape implements Colorable {  
    private radius : float;  
    private color : string;  
    
    constructor(radius : float) {  
        super("Circle");  
        this.radius = radius;  
        this.color = "white";  
    };  
    
    // Implement abstract methods  
    override fn draw() : void {  
        std::println("Drawing a " + this.color + " circle");  
    };  
    
    override fn getArea() : float {  
        return 3.14159 * this.radius * this.radius;  
    };  
    
    // Implement interface methods  
    public fn setColor(color : string) : void {  
        this.color = color;  
    };  
    
    public fn getColor() : string {  
        return this.color;  
    };  
};  

fn main() : int {  
    circle : ColoredCircle = new ColoredCircle(5.0);  
    circle.setColor("red");  
    circle.draw();  
    
    return 0;  
};  

🌟 Milestone Significance

OOP Framework Completion

This version marks the complete realization of CodeNothing's OOP framework:

Simple scripting → Enterprise OOP Language
Learning project → Production-ready tool
Basic functionality → Modern language standard

Technical Achievements

  • Complete modern OOP support
  • Features comparable to mainstream languages
  • Clear syntax design
  • Robust parser architecture

Developer Capabilities

Developers can now use CodeNothing for:

  • Complex object-oriented design
  • Interface-driven architecture
  • Multi-level inheritance systems
  • Modern software engineering practices

🔄 Compatibility

Backward Compatibility

  • ✅ Existing OOP code works unchanged
  • ✅ Class, inheritance, and abstract features maintained
  • ✅ Static member functionality fully compatible

New Features

  • ✅ Added interface definition syntax
  • ✅ Added interface inheritance syntax
  • ✅ Added class implementation syntax
  • ✅ Complete interface system support

📝 Test Verification

Interface System Tests

  • ✅ Basic interface definition and parsing
  • ✅ Interface inheritance (single and multiple)
  • ✅ Class interface implementation (single and multiple)
  • ✅ Interface method declaration parsing
  • ✅ Combined inheritance and interface implementation

Parser Tests

  • ✅ Full interface syntax parsing passed
  • ✅ Error handling and recovery mechanisms
  • ✅ Complex OOP structures parsed successfully
  • ✅ Syntax error collection and reporting

🎉 Summary

CodeNothing v0.3.11 completes the OOP puzzle!

This historic milestone version marks CodeNothing's evolution from a simple scripting language to a programming language with complete modern OOP capabilities.

🌟 Core Achievements:

  • Comprehensive Interface System - Supports interface definition, inheritance, and implementation
  • Modern OOP Standard - Achieves Java/C# level OOP functionality
  • Enterprise Capabilities - Supports complex software architecture
  • Production-Ready - Ready for real-world project development

🚀 **...

Read more