graphlang / README.md
Nanny7's picture
docs: add YAML metadata block with tags for HF discoverability
7d97769
|
Raw
History Blame Contribute Delete
9.56 kB
---
license: other
license_name: bsl-1.1
license_link: https://github.com/cripto-bot/graphlang/blob/master/LICENSE
pretty_name: GraphLang Universal Semantic Kernel for Code
language:
- en
tags:
- graphlang
- semantic-ir
- code-compression
- compiler
- programming-languages
- kolmogorov-compression
- universal-grammar
- n-4-12
- josue-argana
- machine-learning
- research
- reproducible-research
- software-engineering
- ast
task_categories:
- other
size_categories:
- 1K<n<10K
---
# GraphLang — 20M functions · 13 languages · 54K funcs/sec · 0 errors
[![License: BSL](https://img.shields.io/badge/License-BSL-blue.svg)](https://mariadb.com/bsl11/)
[![Python](https://img.shields.io/badge/Python-3.12-blue.svg)](https://python.org)
[![20M Benchmark](https://img.shields.io/badge/benchmark-20M%20functions-green.svg)]()
[![0 Errors](https://img.shields.io/badge/errors-0-brightgreen.svg)]()
[![54K/sec](https://img.shields.io/badge/speed-54K%20funcs%2Fsec-orange.svg)]()
[![Archived](https://img.shields.io/badge/Software_Heritage-archived-blue.svg)](https://archive.softwareheritage.org/)
**The world's first universal semantic kernel for code.**
**20,000,000 functions** processed in 365 seconds
**54,769 funcs/sec** — production-ready, not a prototype
**100% success rate** — 0 errors across 20M functions
**13/13 languages** — Python, Java, JS, TS, C#, Rust, Go, Kotlin, Ruby, PHP, Zig, C, C++
**IR→Code Decoder** — deterministic, temperature zero, all 13 languages
Not a new language — a semantic IR that discovers equivalences invisible
to traditional AST analysis. Same intent = same structure.
> Author: **Josué Argaña Silguero** — 2026
> Repo: `https://github.com/cripto-bot/graphlang`
---
## 📊 Key Metrics
| Metric | Value | What it means |
|--------|-------|---------------|
| **Compression (multilingual)** | **29.8x** (97%) | 320M nodes → 10.8M unique across 13 languages |
| **Compression (monolingual)** | **22.5x** (96%) | 434M nodes → 19.3M unique across 3 languages |
| **Cross-language equivalence** | **97%** avg | Same intent = same IR structure |
| **Languages covered** | **13** (11 at 100%) | Python, Java, JS, TS, C#, Rust, Go, Kotlin, Ruby, PHP, Zig, C, C++ |
| **CST → IR reduction** | **~2,215 → 12** | 97% avg coverage across all languages |
> **Keywords**: semantic IR, intermediate representation, code compression,
> cross-language analysis, AST normalization, source code migration,
> program analysis, compiler design, tree-sitter, BSL license.
## 🎯 What GraphLang Proves
> *Different programming languages converge to the same intermediate
> representation when their computational intent is equivalent.*
```
Python: add(a,b): return a+b ─┐
Java: int add(int a,int b){return ─┤ → SAME GraphLang IR
a+b;} ─┘ (identical structure)
Zig: fn add(a:i32,b:i32)i32{
return a+b;} ─┘
```
Traditional AST analysis sees these as completely different.
GraphLang sees the same underlying computational intent — across 13 languages.
---
## 🏗️ Architecture
GraphLang defines **12 universal IR kinds** derived from the systematic analysis
of ~2,215 Concrete Syntax Tree node types across 13 programming languages.
### The 12 IR Kinds (FROZEN)
| # | Kind | Semantic Meaning |
|---|------|-----------------|
| 1 | `function` | Executable unit with parameters |
| 2 | `if` | Conditional branch |
| 3 | `for` | Bounded iteration |
| 4 | `while` | Unbounded iteration |
| 5 | `return` | Value return |
| 6 | `assign` | Variable binding |
| 7 | `call` | Invocation |
| 8 | `binop` | Binary or comparison operation |
| 9 | `unary` | Unary operation |
| 10 | `var` | Variable reference |
| 11 | `const` | Literal constant |
| 12 | `block` | Statement sequence |
> **FROZEN as of July 28, 2026.** These 12 kinds are immutable. See [SPEC.md](SPEC.md).
### Language Coverage
| Language | CST Types | Core IR | Status |
|----------|-----------|---------|--------|
| Python | 238 | 100% | Production |
| Java | 296 | 100% | Production |
| JavaScript | 242 | 100% | Production |
| TypeScript | ~250 | 100% | Production |
| C# | ~220 | 100% | Production |
| Rust | 290 | 100% | Production |
| Go | 199 | 100% | Production |
| Kotlin | ~200 | 100% | Production |
| Ruby | ~180 | 100% | Production |
| PHP | ~190 | 100% | Production |
| Zig | ~150 | 100% | Production |
| C | ~180 | 93% | Stabilized |
| C++ | ~300 | 93% | Stabilized |
> **C/C++ at 93%** is a deliberate engineering decision. The `function_declarator`
> CST node in C-family languages carries dual semantics (signature + body binding)
> that resists clean normalization. Rather than add a fragile 13th IR kind, we
> freeze the specification. See [SPEC.md §3](SPEC.md).
---
## 📈 Benchmarks
## 📈 Benchmarks
### 📊 Compression (Normalizer)
| Functions | Total Nodes | Unique Patterns | Ratio | Time | Errors |
|-----------|-------------|-----------------|-------|------|--------|
| 1,500 | 33,387 | 1,197 | 27.9x | 1s | 0 |
| 10,000 | 216,883 | 9,770 | 22.2x | 3s | 0 |
| 100,000 | 2,172,203 | 96,504 | 22.5x | 40s | 0 |
| 1,000,000 | 21,701,749 | 965,037 | 22.5x | 20s | 0 |
| 10,000,000 | 217,017,500 | 9,649,181 | 22.5x | 203s | 0 |
| 20,000,000 | 434,035,010 | 19,298,367 | 22.5x | 410s | 0 |
| **20M multilingual** | **320,512,500** | **10,769,320** | **29.8x** | **290s** | **0** |
> Compression converges at 22.5x (monolingual) and 29.8x (multilingual).
> Stable from 100K to 20M functions. This is a constant, not an estimate.
### 🔄 IR→Code Decoder (Temperature Zero)
| Functions | Languages | Success | Roundtrip | Time | Errors |
|-----------|-----------|---------|-----------|------|--------|
| 130,000 | 13 | **100%** | 53.8% | 2.3s | 0 |
| 1,040,000 | 13 | **100%** | 53.8% | 18.9s | 0 |
| 20,000,000 | 13 | **100%** | 53.8% | 365s | 0 |
> **54,769 funcs/sec** — deterministic IR→Code translation at scale.
> 7 languages achieve 100% structural roundtrip.
| 20,046,000 | 320,512,500 | 10,769,320 | 29.8x | 290s |
**Compression converges to a constant**: 22.5x (monolingual) and 29.8x
(multilingual) from 100K functions onward. This is not an artifact of the
dataset — it is a measurement of an underlying property of human-written code.
---
## 📂 Public Repo Structure
```
graphlang/
├── core.py # IR engine: Node, Graph, merge O(N)
├── normalizer.py # Legacy normalizer
├── adapter.py # Legacy CST → IR adapter
├── parallel_ir.py # GPU/HPC extension (CUDA, OpenCL, Metal)
├── SPEC.md # Formal IR specification (FROZEN)
├── TECHNICAL.md # Technical whitepaper
├── IP.md # Prior art declaration
├── paper/ # Academic paper (ArXiv-ready)
├── legal/ # US legal framework + checklist
├── marketing/ # LinkedIn profile + launch posts
├── LICENSE # BSL 1.1 (converts to MIT July 28, 2046)
├── CONTACT.md # Commercial licensing tiers
├── ENTERPRISE.md # Enterprise pricing
└── README.md
```
> **Note**: The complete normalizer engine, benchmark generators, dataset, and
> Cloud API are available under commercial license. See [ENTERPRISE.md](ENTERPRISE.md).
---
## 🔬 Research Frontiers
GraphLang has enabled 10 fundamental discoveries beyond compression:
| # | Discovery | Finding |
|---|-----------|---------|
| 1 | **Universal Language** | 21 transitions cover 100% of code. 123/144 empty. |
| 2 | **Semantic Z3 Prover** | Formally proves program equivalence ∀ inputs. |
| 3 | **Intent Reconstruction** | Infers *what* code does, not just *how*. 9 patterns. |
| 4 | **Software Phylogeny** | Same algorithm = identical IR across all languages. |
| 5 | **Physics of Software** | Code has measurable energy. Identical across languages. |
| 6 | **Max Compression** | 51 motifs cover all observed code. 32 cover 95%. |
| 7 | **Algorithm Discovery** | Evolutionary synthesis of novel algorithms. |
| 8 | **Predictor** | 314M transitions. Transition matrix converged at 10M. |
| 9 | **Cross-Language IR** | 13 languages. Same intent = same 12-kind graph. |
| 10 | **Compression Stability** | 22.5x (mono) / 29.8x (multi). Stable 1.5K→20M. |
Full details in [paper/paper.md](paper/paper.md).
---
## 📚 Citation
```bibtex
@software{GraphLang2026,
author = {Josué Argaña Silguero},
title = {GraphLang: A Universal Semantic Kernel for Code —
29.8x Cross-Language Compression Across 13 Languages},
year = {2026},
url = {https://github.com/cripto-bot/graphlang}
}
```
---
## 📄 License
**Business Source License 1.1** — free for research, personal, and non-commercial use.
Converts to MIT on **July 28, 2046**.
- **Non-commercial & research use**: ✅ Free. Use it, modify it, publish papers.
- **AI/ML training use**: ❌ Requires commercial license.
- **Production/commercial use**: ❌ Requires commercial license.
**Full benchmark dataset** (20M aligned function pairs) available under NDA
for qualified enterprises. Contact **josu31.jas@gmail.com** for access.
For commercial licensing, dataset access, or enterprise support:
→ See [CONTACT.md](CONTACT.md) or [ENTERPRISE.md](ENTERPRISE.md)
---
*"No hemos inventado un nuevo lenguaje. Hemos descubierto que todos los lenguajes ya hablaban el mismo."*