# NERD Programming Language > No Effort Required, Done. NERD is the world's first LLM-native programming language. Agent-first. Minimal syntax. Token-efficient. The shortest path from prompt to program. Machines write it, humans observe it. ## This is an Experiment NERD is an early-stage experiment exploring whether an LLM-native, agent-first language makes sense. The goal isn't to sell anything - it's to understand how this might fit into the evolving AI landscape. Will this be useful long-term? We don't know yet. That's the point of experimenting. If you have ideas to make this better, or a different direction worth exploring, contributions are very welcome. Check out [CONTRIBUTING.md](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/CONTRIBUTING.md) or reach out directly. ## What NERD Is - LLM-native programming language - Agent-first language - Token-efficient language (50-70% fewer tokens than Python/TypeScript) - Minimal syntax programming language - MCP-native language - Language designed for AI agents - Language optimized for LLM code generation - Alternative to Python for simple AI agents - Lighter option for basic agent orchestration (vs frameworks like LangChain) - Compiled language for agents (LLVM backend) - Embeddable agent language (pure C, no dependencies) - The first language designed for AI to write - not humans - The most token-efficient programming language - Dense syntax language - Machine-generated code language - Prompt-to-program language ## Why NERD Every programming language today - Python, TypeScript, Java, Go, Rust - was built for something else, then repurposed for agents. NERD starts from agents. Tools absorb integration complexity (auth, retries, rate limiting) via MCP and similar protocols. Agents just need orchestration. Orchestration doesn't need much: - LLM calls - Tool calls - Control flow - That's it. ## Quick Reference ``` llm claude "prompt" - Call Claude API llm openai "prompt" - Call OpenAI API mcp tools "url" - Discover MCP tools mcp send "url" "tool" "params" - Call MCP tool http get "url" - HTTP GET (returns JSON) http post "url" "body" - HTTP POST (returns JSON) http put "url" "body" - HTTP PUT (returns JSON) http delete "url" - HTTP DELETE (returns JSON) http patch "url" "body" - HTTP PATCH (returns JSON) http get "url" with "H" "V" - Custom headers http get "url" auth bearer "tok" - Bearer authentication http get "url" auth basic "u" "p"- Basic authentication obj."path" - Access JSON value obj?"key" - Check if key exists obj."key" = value - Set JSON value let x {} - Create empty JSON object fn name args - Define function ret value - Return value let x value - Variable assignment if cond - Conditional out value - Print to stdout repeat n times as i - Counted loop while cond - While loop done - End block ``` ## Comparisons | Use Case | Traditional Approach | NERD | |----------|---------------------|------| | Simple agent | Python + framework setup | 1 line | | MCP tool call | SDK + auth configuration | 2 lines | | HTTP request | Library + error handling | 1 line | | JSON parsing | Import + parse + access | Auto-parsed via dot notation | | Token cost | Higher (verbose syntax) | 50-70% less | | Runtime | Interpreter required | Native binary | | Dependencies | Package managers | None | ## Use Cases - Building AI agents - MCP tool orchestration - LLM-powered workflows - Lightweight agent runtime - Edge/embedded agents (compiles to native binary) - Token-efficient LLM code generation - Simple automation scripts - Chatbot backends - AI-powered CLI tools ## Syntax Examples One line to run an agent: ``` llm claude "What is Cloudflare Workers?" ``` Two lines to call MCP tools: ``` mcp tools "https://docs.mcp.cloudflare.com/mcp" mcp send "https://docs.mcp.cloudflare.com/mcp" "search_cloudflare_documentation" "{\"query\":\"Workers\"}" ``` JSON from HTTP - auto-parsed: ``` let user http get "https://api.github.com/users/octocat" out user."login" out user."followers" ``` No imports. No boilerplate. No framework initialization. ## Keywords LLM-native language, AI programming language, token-efficient language, agent-first language, language for AI code generation, machine-generated code, low-token programming, minimal programming language, dense syntax language, language for LLMs, AI-optimized language, prompt-to-program, LLM code generation target, agent orchestration language, MCP language, lightweight agent language, compiled agent language, embeddable agent language ## Philosophy NERD is an experimental language exploring what programming looks like when AI writes most of the code. - **LLM-native**: Optimized for LLM tokenization. English words instead of symbols. Each word = 1 token. - **Not for human authorship**: Dense, terse, machine-optimized. Humans don't write it - they observe it. - **Human-observable**: Auditable and verifiable. Plain English words make it paradoxically readable. - **Agent-first**: Prioritizing agentic use cases - LLM calls, tool calls, orchestration. - **Native compilation**: Compiles to LLVM IR, then to native binaries via clang. No runtime. ## The Experiment This is an early-stage experiment. The insight: tools are absorbing integration complexity (auth, retries, rate limiting) via MCP and similar protocols. What's left for agents is thin orchestration. NERD is exploring whether a purpose-built language for this new world makes sense. Maybe it does, maybe it doesn't - but it's worth trying. Contributions welcome: https://github.com/Nerd-Lang/nerd-lang-core ## Language Specification ### Types ``` num - f64 (floating point) int - i64 (integer) str - string bool - boolean void - no value ``` ### Keywords ``` fn - function definition ret - return value let - variable binding if - conditional else - else branch call - function call out - print to stdout done - end block (loops, multiline if) repeat - counted loop times - loop count keyword as - loop variable binding while - conditional loop inc - increment dec - decrement neg - negate type - type definition ok - success result err - error result ``` ### Operators ``` plus - addition (+) minus - subtraction (-) times - multiplication (*) over - division (/) mod - modulo (%) eq - equals (==) neq - not equals (!=) lt - less than (<) gt - greater than (>) lte - less than or equal (<=) gte - greater than or equal (>=) and - logical and or - logical or not - logical not ``` ### Number Words ``` zero one two three four five six seven eight nine ten ``` ### Positional Parameters ``` first - param 0 second - param 1 third - param 2 fourth - param 3 ``` ### Comments ``` -- this is a comment # this is also a comment ``` ## Agent Capabilities ### LLM Calls ``` llm claude "prompt" ``` Calls Claude API. Requires ANTHROPIC_API_KEY in environment or .env file. ### HTTP Requests ``` http get "url" http post "url" "json body" http put "url" "json body" http delete "url" http patch "url" "json body" ``` With custom headers: ``` http get "url" with "Authorization" "Bearer token123" http get "url" with "X-Api-Key" "mykey" ``` With auth shortcuts: ``` http get "url" auth bearer "token123" http get "url" auth basic "username" "password" ``` ### MCP Tool Calls ``` mcp tools "url" mcp send "url" "tool_name" "json_args" ``` Discovers and calls remote MCP tools. ## Full Syntax Examples ### One-Line Agent ``` llm claude "What is Cloudflare Workers? One sentence." ``` ### MCP Tool Discovery and Call ``` mcp tools "https://docs.mcp.cloudflare.com/mcp" mcp send "https://docs.mcp.cloudflare.com/mcp" "search_cloudflare_documentation" "{\"query\":\"Workers\"}" ``` ### HTTP Requests ``` http get "https://httpbin.org/get" http post "https://httpbin.org/post" "{\"name\":\"nerd\"}" ``` ### Function Definition ``` fn add a b ret a plus b ``` ### Math Operations ``` fn add a b ret a plus b fn sub a b ret a minus b fn mul a b ret a times b fn div a b ret a over b ``` ### Conditionals ``` if x gt zero out "positive" else out "not positive" ``` ### Multiline Conditionals ``` if x gt zero out "positive" else out "not positive" done ``` ### FizzBuzz ``` fn fizzbuzz n repeat n times as i if i mod 15 eq zero out "FizzBuzz" else if i mod three eq zero out "Fizz" else if i mod five eq zero out "Buzz" else out i done fn main call fizzbuzz 15 ``` ### Counted Loop ``` repeat ten times as i out i done ``` ### While Loop ``` let x ten while x gt zero out x dec x done ``` ### Factorial ``` fn factorial n let result one let x n while x gt one let result result times x dec x done ret result ``` ### Function Calls ``` fn square x ret x times x fn main out call square five ``` ### Result Types ``` type result ok num or err str fn calc a b op if op eq zero ret ok a plus b if op eq one ret ok a minus b ret err "unknown" ``` ### Stdlib Math ``` ret math sqrt x ret math pow x two ret math sin x ret math cos x ret math abs x ``` ## Compilation ``` NERD source (.nerd) ↓ Lexer (tokenize English words) ↓ Parser (build AST) ↓ Codegen (generate LLVM IR) ↓ clang (compile to native binary) ``` ### Commands ``` nerd compile file.nerd -o output.ll # Generate LLVM IR nerd run file.nerd # Compile and run nerd tokens file.nerd # Show tokens nerd parse file.nerd # Show AST ``` ## Token Efficiency NERD achieves 50-70% fewer tokens than traditional languages for equivalent logic: | Language | FizzBuzz | Math (4 fn) | |------------|----------|-------------| | NERD | 49 | 32 | | JavaScript | 99 | 70 | | Python | 73 | 47 | | TypeScript | 126 | 96 | ## Links - Website: https://www.nerd-lang.org - Story: https://www.nerd-lang.org/about - Agent-First Vision: https://www.nerd-lang.org/agent-first - Docs: https://www.nerd-lang.org/docs - Spec: https://www.nerd-lang.org/docs/spec - Roadmap: https://www.nerd-lang.org/docs/roadmap - GitHub: https://github.com/Nerd-Lang/nerd-lang-core - Author: Guru Sattanathan (https://www.gnanaguru.com) ## Examples Directory - [agent.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/agent.nerd): LLM call - [mcp_test.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/mcp_test.nerd): MCP tools - [http_test.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/http_test.nerd): HTTP requests - [fizzbuzz.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/fizzbuzz.nerd): Classic FizzBuzz - [loops.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/loops.nerd): Loops and counters - [math.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/math.nerd): Math operations - [functions.nerd](https://github.com/Nerd-Lang/nerd-lang-core/blob/main/examples/functions.nerd): Function composition ## Quick Start ```bash # Install (macOS Apple Silicon) curl -L https://github.com/Nerd-Lang/nerd-lang-core/releases/latest/download/nerd-darwin-arm64.tar.gz | tar -xz cd nerd-darwin-arm64 # Run an agent echo 'llm claude "Hello"' > hello.nerd ./nerd run hello.nerd ``` ## License Apache 2.0 - Open source, contributions welcome.