NO Language is an experimental, natural-language-first programming language (a small DSL) that turns human instructions into executable Python.
Instead of writing low-level syntax everywhere, you write intent:
make_dataframe ```pandas {
create a dataframe with 5 rows of random numbers
print the mean of the first column
}
Visualizer ```matplotlib {
plot the data from make_dataframe as a red line
show it
}
Output
output_code ->
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(5, 3))
print(df[0].mean())
import matplotlib.pyplot as plt
plt.plot(df[0], color='red')
plt.show()
Behind the scenes, NO:
- Parses your
.nofile using a real grammar (Lark). - Transpiles each block into Python using Gemini.
- Validates the generated code (syntax + security checks).
- Executes the final program.
This repo is intentionally small but engineered like a real compiler pipeline.
This is not “just prompts.” It’s a language toolchain:
- Formal parsing: A dedicated grammar (
core/grammar.lark) with nested blocks, named blocks, optional type hints, and verbatim blocks. - Context-aware compilation: Each block is compiled with the already-generated Python as context so references resolve naturally.
- Defense-in-depth execution: Generated Python is AST-parsed for syntax, then scanned for dangerous calls before it can run.
- Built-in AI debugging: When execution fails, the engine requests a compact explanation + likely
.no-level fix.
- 249 lines of Python across the compiler runtime (
main.py+core/*.py). - 13 grammar productions defining the NO syntax (
core/grammar.lark). - 2 compilation modes:
- “Natural language blocks” → Python
:::langverbatim code blocks (e.g., C++/Java) → Python
- 7 blocked high-risk API patterns in the default security blacklist.
- 2 runtime dependencies:
lark,google-genai
.no file
↓
Lark parser (core/grammar.lark)
↓
AST walk per block
↓
Gemini transpilation (block-by-block, context aware)
↓
Sanitize output (strip markdown fences if any)
↓
Validate:
- Syntax: ast.parse()
- Security: blacklist scan on AST
↓
exec() the final Python program
Core components:
core/engine.py: parsing + compilation orchestration + execution + AI debuggercore/validator.py: AST-based validation (syntax + blacklist security scan)core/grammar.lark: language grammarmain.py: minimal CLI entrypoint
create your own venv:
python -m venv .venv
./.venv/Scripts/Activate.ps1pip install -r requirements.txtThis project reads the API key from the environment variable GEMINI_API_KEY.
PowerShell:
$env:GEMINI_API_KEY = "YOUR_KEY_HERE"Make sure your venv is activated first (so google-genai is available).
python main.py test.noWhat you’ll see:
- A “Compiling …” line for each NO block
- The full generated Python printed before execution
- The program output
NO is block-based.
[type_hint] block_name [library_list] {
commands...
nested blocks...
}
- type_hint:
func,function, orclass(optional) - block_name: an identifier, optionally with parameters:
name(a, b) - library_list (optional): triple-backtick token followed by library names, used as a transpilation hint
Example:
func make_dataframe ```pandas {
create a dataframe with 5 rows of random numbers
print the mean of the first column
}
Use this when you want to paste code from another language and ask NO to convert it into Python.
:::cpp cpp_block <---
// C++ here
--->
NO executes LLM-generated Python. To reduce risk, the runtime includes a basic AST-based denylist that blocks calls matching these patterns:
os.systemsubprocessshutilevalexecopenremove
Notes:
- This is a best-effort safeguard, not a hardened sandbox.
- Treat
.noprograms like code execution: run in an isolated environment.
- Output quality depends on the LLM; generated code can still be wrong even if syntactically valid.
- The security layer is intentionally simple and may miss dangerous constructs.
- There’s no persistent module system yet; compilation is currently “single-file, in-order”.
- Replace denylist with a safer execution model (capabilities / allowlist / sandbox)
- Add deterministic semantics for variables + types (symbol table enforcement)
- Add test harness and golden-file tests for stable transpilation
- Improve error mapping from Python tracebacks back to
.noblocks
