Metadata-Version: 2.4
Name: janky-sys
Version: 1.0.5
Summary: Hyper-optimized, multi-language polyglot JIT framework for Python.
Author: GUGUGAGA
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Compilers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: systems
Provides-Extra: zig
Provides-Extra: nim
Provides-Extra: all
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# ⚡ janky-sys

> "Because choosing a single programming language is a sign of weakness."

`janky-sys` is a hyper-optimized, low-level polyglot JIT framework for Python. It bypasses traditional runtime overhead by embedding 12 language JIT/compilation engines directly inside native C Python Extensions. By combining `mmap`, `dlopen`, `dlsym`, and raw machine code execution, it allows you to compile and execute any language inline inside Python at raw bare-metal speeds.

---

## 🛠️ The Janky Toolchain Lineup

The runtime framework consists of **12 unified engine extensions**:

| Extension | Language | Execution Strategy | Target Requirements |
| :--- | :--- | :--- | :--- |
| `jasm` / `jasm86` | Intel Assembly | Inline Bytecode Pipeline | System `nasm` / Native Kernel |
| `jinary` | Raw Bytecode | `mmap` + `mprotect` Page Injection | None (Pure Hex Opcodes) |
| `jc` / `jcpp` | C / C++ | Dynamic `.so` JIT via GCC/Clang | `gcc` / `clang` |
| `just` | Rust | Cargo Dynamic Cdylib Engine | `rustc` / `cargo` |
| `jig` | Zig | Blazing-fast native compilation | `zig` |
| `jnim` | Nim | Transpiled C binary emission | `nim` |
| `jgo` | Go | Embedded runtime shared links | `go` |
| `jortran` | Fortran | Numerical optimization backend | `gfortran` |
| `jython` | Inline CPython | Sub-interpreter bypass strings | Python Development Headers |
| `jbrainfuck` | Brainfuck | Esoteric bytecode array VM | None (Built-in interpreter) |

---

## 🚀 Architectural Blueprint

Every compiler engine utilizes an optimized, secure dual-pass pipeline to guarantee zero-overhead execution states:

1. **SHA-256 Content Validation:** Incoming code block strings are securely hashed via OpenSSL (`libcrypto`) and compared against cached structural artifacts inside `.janky_cache/`.
2. **Dynamic Compilation:** On cache misses, sub-process toolchains are cleanly invoked with local file boundaries.
3. **Memory Execution Map:** Binaries are loaded via `dlopen`/`dlsym` or locked inside page-aligned memory slots using kernel-level `mprotect(PROT_READ | PROT_EXEC)`.
4. **Unified Register Calling Bridge:** Arguments are mapped straight into low-level registers (`rdi`, `rsi`, `rdx`...) using a unified `Box` type tag system.

### 💎 The Unified Type Tag Registry
To pass floating-point numbers or configure return pathways across standard system calling conventions, append the following register map integer tags to `.compile(source, symbol, type_id)`:

* **`0`**: Standard Integer / Array Buffer Address Pointer (`uint64_t`) [Default]
* **`1`**: IEEE 754 Double Precision Floating Point (`double` -> `xmm0`)
* **`2`**: IEEE 754 Single Precision Floating Point (`float` -> `xmm0`)

---

## 💻 Elite Code Showcases

### 1. Zig (`jig`)
```python
from janky.compiler import jig

jig.set_flags("-mcpu=native")
src = """
export fn zig_multiply(x: f64, y: f64) f64 {
    return x * y;
}
"""
# Type ID 1 explicitly configures double-precision float return maps
fn = jig.compile(src, "zig_multiply", 1)
print(fn(3.5, 2.0))  # Output: 7.0

```

### 2. Pure Binary (`jbinary`)

```python
from janky.compiler import jbinary

# Layout pure hex opcodes. Supports comments (#) and spacing!
bytecode = """
48 89 f8    # mov rax, rdi (Move 1st argument register to return register)
48 01 f0    # add rax, rsi (Add 2nd argument register to rax)
c3          # ret
"""
fn = jbinary.compile(bytecode, "pure_jit")
print(fn(40, 2))  # Output: 42

```

### 3. Rust (`just`)

```python
from janky.compiler import just

src = """
#[no_mangle]
pub extern "C" fn rust_max(a: u64, b: u64) -> u64 {
    if a > b { a } else { b }
}
"""
fn = just.compile(src, "rust_max")
print(fn(99, 1000))  # Output: 1000

```

### 4. Fortran (`jortran`)

```python
from janky.compiler import jortran

src = """
double precision function fort_add(a, b)
    double precision, intent(in) :: a, b
    fort_add = a + b
end function fort_add
"""
fn = jortran.compile(src, "fort_add", 1)
print(fn(1.23, 4.56))  # Output: 5.79

```

### 5. Go (`jgo`)

```python
from janky.compiler import jgo

src = """
package main
import "C"

//export GoSub
func GoSub(a, b int64) int64 {
    return a - b
}
func main() {}
"""
fn = jgo.compile(src, "GoSub")
print(fn(100, 30))  # Output: 70

```

---

## 📦 Installation

To build and hook all 12 native extensions into your local environment workspace:

```bash
# Clone the repository
git clone [https://github.com/GUGUGAGA/janky-sys.git](https://github.com/GUGUGAGA/janky-sys.git)
cd janky-sys

# Perform an editable developer link compilation
pip install -e .

```

*Note: Ensure system-level binary dependencies (`gcc`, `nasm`, `zig`, `nim`, `go`, `gfortran`) and OpenSSL development components are pre-configured inside your POSIX environment loop path variables.*

---

## 📜 License

The Janky Framework is forged under the **MIT License**. Use at your own hardware risk.

```
