DEV Community

ansurfen
ansurfen

Posted on

Hulo Programming Language: Module System Delayed, but Batch/PowerShell Integration & Initial Interpreter Release

It's time for the weekly Hulo update!

This v0.3.0 update has evolved Hulo from a "simple transpiler" into a "modern programming language with compile-time evaluation capabilities."

Sounds cool, right? Let me tell you what's actually been updated this time.

๐Ÿš€ Major Updates This Week

1. Full Platform Transpiler Officially Complete!

Yes, you read that right! Hulo now supports four major platforms for script transpilation:

  • โœ… VBScript (.vbs) - Classic Windows scripting
  • โœ… Bash (.sh) - Linux/macOS Shell scripting
  • โœ… Batch (.bat/.cmd) - Windows batch processing
  • โœ… PowerShell (.ps1) - Modern Windows scripting

This means you can use the same modern syntax to generate scripts for all mainstream platforms!

Currently supports basic statement conversion, with more advanced features under development

2. Compile-time Evaluation System - comptime is Here!

This is the biggest highlight of this update! Hulo now supports compile-time evaluation, allowing code execution during compilation and generating different ASTs based on results.

Let's look at some practical examples:

Compile-time Computation

let a = comptime {
    let sum = 0
    loop $i := 0; $i < 10; $i++ {
        echo $i;
        $sum += $i;
    }
    return $sum
}

// Compile-time computation result: a = 45
echo $a
Enter fullscreen mode Exit fullscreen mode

Conditional Compilation

comptime when $TARGET == "powershell" {
    Write-Host "Hello, PowerShell"
} else when $TARGET == "batch" {
    echo "Hello, Batch"
} else when $TARGET == "bash" {
    echo "Hello, Bash"
} else when $TARGET == "vbs" {
    MsgBox "Hello, VBScript"
}
Enter fullscreen mode Exit fullscreen mode

Generated PowerShell code:

Write-Host "Hello, PowerShell"
Enter fullscreen mode Exit fullscreen mode

Generated Batch code:

echo "Hello, Batch"
Enter fullscreen mode Exit fullscreen mode

Generated Bash code:

echo "Hello, Bash"
Enter fullscreen mode Exit fullscreen mode

Generated VBScript code:

MsgBox "Hello, VBScript"
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”ง Technical Architecture Upgrade

Compile-time Evaluation Engine

The new comptime system provides:

  • Runtime evaluation - Execute code during compilation
  • AST transformation - Modify syntax trees based on computed results
  • Dynamic code generation - Generate different code based on conditions

๐Ÿšง Next Steps

  1. Module System - Support for third-party library imports (delayed to v0.4.0)
  2. Command Gymnastics - Smarter cross-platform command adaptation
  3. Package Publishing System - Allow community to share and reuse code
  4. Language Server - Better IDE support

๐Ÿ’ญ Final Thoughts

This update has transformed Hulo from a simple transpiler into a modern programming language with compile-time evaluation capabilities. The addition of the comptime system brings unlimited possibilities to Hulo.

Although the module system has been delayed, the technology stack is more complete and powerful. We believe that in v0.4.0, the module system will be presented to everyone in a more elegant way.

Project address: https://github.com/hulo-lang/hulo

If you find this project interesting, feel free to raise issues or participate in discussions on GitHub! Give it a Star to support and let more people see this project.

What do you think about this "compile-time evaluation + multi-platform transpilation" approach? Any suggestions or thoughts?

Top comments (0)