Skip to content

vpetreski/humanlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

humanlang

A programming language with no compiler.

"Human language is the best programming language in the future." — Jensen Huang

humanlang


humanlang is a programming language where the syntax is natural English. There is no compiler. There is no interpreter. There is only a specification, a set of tests, and you — talking to an AI agent that builds the implementation.

Read the full article →


What Does It Look Like?

-- FizzBuzz in humanlang

for n from 1 to 100:
    if n modulo 15 is equal to 0:
        print "FizzBuzz"
    otherwise if n modulo 3 is equal to 0:
        print "Fizz"
    otherwise if n modulo 5 is equal to 0:
        print "Buzz"
    otherwise:
        print n
-- Functions and lists

define greet with name:
    return "Hello, " joined with name joined with "!"

set guests to ["Alice", "Bob", "Charlie"]
for each guest in guests:
    print call greet with guest
-- Recursion

define factorial with n:
    if n is at most 1:
        return 1
    return n times (call factorial with (n minus 1))

print call factorial with 10

What's in This Repo?

File What It Is
SPEC.md Complete language specification with EBNF grammar
tests.yaml 86 language-agnostic test cases
INSTALL.md Instructions for building humanlang (a prompt)
examples/ Example programs in .hl format
python/ AI-generated Python interpreter (1,465 lines)
typescript/ AI-generated TypeScript interpreter (2,188 lines)
kotlin/ AI-generated Kotlin interpreter (1,332 lines)
rust/ AI-generated Rust interpreter (2,103 lines)
ocaml/ AI-generated OCaml interpreter (1,429 lines)
zig/ AI-generated Zig interpreter (1,741 lines)
haskell/ AI-generated Haskell interpreter (1,243 lines)
asm/ AI-generated ARM64 assembly interpreter (5,271 lines)

Implementations

AI-generated interpreters, each built from nothing but SPEC.md and tests.yaml. Different paradigms. One spec. All passing 86/86 tests.

Language Paradigm Lines Files Build
Python Dynamic / Scripting 1,465 Single file python3 humanlang.py
TypeScript Typed JS / Node.js 2,188 Single file npx tsx humanlang.ts
Kotlin JVM / OOP+FP 1,332 Single file kotlinc humanlang.kt -include-runtime -d humanlang.jar
Rust Systems / Ownership 2,103 6 modules cargo build --release
OCaml Functional / ADTs 1,429 Single file ocamlopt -o humanlang humanlang.ml
Zig Manual memory / Zero overhead 1,741 Single file zig build -Doptimize=ReleaseSafe
Haskell Pure lazy functional 1,243 Single file ghc -O2 -o humanlang Main.hs
ARM64 Assembly Raw machine instructions 5,271 Single file cc -o humanlang humanlang.s

Run

# Python
cd python && python3 humanlang.py ../examples/fizzbuzz.hl

# TypeScript
cd typescript && npm install && npx tsx humanlang.ts ../examples/fizzbuzz.hl

# Kotlin
cd kotlin && kotlinc humanlang.kt -include-runtime -d humanlang.jar
java -jar humanlang.jar ../examples/fizzbuzz.hl

# Rust
cd rust && cargo build --release
./target/release/humanlang ../examples/fizzbuzz.hl

# OCaml
cd ocaml && ocamlopt -o humanlang humanlang.ml
./humanlang ../examples/fizzbuzz.hl

# Zig
cd zig && zig build -Doptimize=ReleaseSafe
./zig-out/bin/humanlang ../examples/fizzbuzz.hl

# Haskell
cd haskell && ghc -O2 -o humanlang Main.hs
./humanlang ../examples/fizzbuzz.hl

# ARM64 Assembly
cd asm && cc -o humanlang humanlang.s
./humanlang ../examples/fizzbuzz.hl

Test

Each implementation includes a run_tests.sh that validates all 86 test cases:

cd python  && bash run_tests.sh   # 86/86 ✓
cd typescript && bash run_tests.sh # 86/86 ✓
cd kotlin  && bash run_tests.sh   # 86/86 ✓
cd rust    && bash run_tests.sh   # 86/86 ✓
cd ocaml   && bash run_tests.sh   # 86/86 ✓
cd zig     && bash run_tests.sh   # 86/86 ✓
cd haskell && bash run_tests.sh   # 86/86 ✓
cd asm     && bash run_tests.sh   # 86/86 ✓

No implementation was hand-written. Each was generated by an AI agent reading the spec and iterating until all tests passed. The spec IS the compiler.


Install

Give your AI coding agent this prompt:

Build a humanlang interpreter in [LANGUAGE].

1. Read SPEC.md for the complete language specification
2. Parse tests.yaml and generate a test file
3. Implement a lexer, parser, and tree-walk interpreter
4. The entry point should accept a .hl file path as a command-line argument
5. Run tests until all pass
6. Place implementation in [LOCATION]

Pick your language. Pick your location. Copy, paste, go.


The Language

humanlang supports:

  • Variablesset x to 10
  • Arithmeticplus, minus, times, divided by, modulo
  • Stringsjoined with, uppercase of, lowercase of, contains
  • Comparisonsis equal to, is greater than, is at most, etc.
  • Logicand, or, not
  • Conditionalsif / otherwise if / otherwise
  • Loopsrepeat N times, for each, for N from X to Y, while
  • Functionsdefine, call, return, recursion
  • Listsfirst of, last of, append, item N of, contains
  • Type conversionas number, as string, as boolean

See SPEC.md for the complete grammar and semantics.


Why?

Ghost libraries — software distributed as specifications rather than code — are gaining traction. A spec and tests that any AI agent can implement in any language. But a library is small.

What if a spec could replace a compiler?

The answer is yes.

humanlang is a complete programming language — variables, functions, loops, recursion, lists — that exists entirely as a specification. No binary. No runtime. No dependency. Just a document that describes how English becomes computation.

The spec IS the compiler. The AI agent IS the build tool. Human language IS the programming language.


License

MIT

About

A programming language with no compiler. Just a spec, tests, and an AI agent. Human language IS the programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors