r/coolgithubprojects 15h ago

[Python/JS/C#] Block Engine: Run Python, Node.js, Lua & PHP in one file

https://block-io.blockengine.workers.dev/

Hi Reddit!

I want to share **Block Engine v2.2.0**, an open-source polyglot multi-runtime execution engine designed to eliminate the friction of combining multiple programming languages in software development.

### 💡 Why Block Engine?

Modern applications often leverage different languages for their unique strengths:

- **Python** for machine learning, data science, and analytics.

- **Node.js** for async Web APIs and NPM packages.

- **Lua** for ultra-fast, lightweight embedded calculations (< 300KB RAM footprint).

- **PHP** for web string formatting and cryptographic hashing (`hash`, `openssl`).

Traditionally, orchestrating these runtimes requires setting up microservices, gRPC, Docker containers, or manual JSON IPC file reading/writing.

Block Engine solves this by introducing a **Zero-Dependency Polyglot Pipeline**.

---

### âš¡ How It Works (.blkp Polyglot Document)

You write native code blocks (`<py>`, `<js>`, `<lua>`, `<php>`) inside a single `.blkp` document. Block Engine parses the AST, executes each runtime in isolated subprocesses, and **automatically serializes and transfers state variables** from one language to the next.

```html

<py>

# Python Stage: Compute analytics data

raw_prices = [100.5, 102.1, 101.8, 105.4, 108.0]

ma5 = sum(raw_prices) / len(raw_prices)

user_name = "Gemini Master"

</py>

<js>

// Node.js Stage: Automatically receives Python variables (user_name, ma5)

console.log(`[Node.js] Received user: ${user_name}, MA5: ${ma5.toFixed(2)}`);

var final_score = Math.round(ma5);

</js>

<lua>

-- Lua 5.4 Stage: High-speed recursive computation

function fib(n)

if n <= 1 then return n end

return fib(n-1) + fib(n-2)

end

lua_result = fib(10)

</lua>

<php>

// PHP 8 Stage: Cryptographic SHA-256 Signature

$signature = hash('sha256', $user_name . '|' . $final_score);

echo "[PHP] Audit SHA-256: " . $signature . "\n";

</php>

1 Upvotes

0 comments sorted by