Nanolang: A tiny experimental language designed to be targeted by coding LLMs
Recorded: Jan. 20, 2026, 10:03 a.m.
| Original | Summarized |
GitHub - jordanhubbard/nanolang: A tiny experimental language designed to be targeted by coding LLMs Skip to content Navigation Menu Toggle navigation
Sign in
Appearance settings PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub SparkBuild and deploy intelligent appsGitHub ModelsManage and compare promptsMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing Search or jump to... Search code, repositories, users, issues, pull requests...
Search Clear
Search syntax tips Provide feedback Include my email address so I can be contacted Cancel Submit feedback Saved searches
Name Query To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up
Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. Dismiss alert jordanhubbard nanolang Public template
Notifications
Fork
Star A tiny experimental language designed to be targeted by coding LLMs Apache-2.0 license 194 11 Branches Tags Activity
Star
Notifications Code Issues Pull requests Discussions Actions Projects Security Uh oh! There was an error while loading. Please reload this page. Insights
Additional navigation options
Code Issues Pull requests Discussions Actions Projects Security Insights
jordanhubbard/nanolang
mainBranchesTagsGo to fileCodeOpen more actions menuFolders and filesNameNameLast commit messageLast commit dateLatest commit History1,290 Commits.beads.beads .cursor.cursor .factory.factory .github.github .vscode.vscode C-samplesC-samples docsdocs editorseditors examplesexamples modulesmodules planningplanning schemaschema scriptsscripts srcsrc src_nanosrc_nano stdstd stdlibstdlib teststests toolstools userguideuserguide .cursorrules.cursorrules .gitattributes.gitattributes .gitignore.gitignore AGENTS.mdAGENTS.md CONTRIBUTING.mdCONTRIBUTING.md CONTRIBUTORS.mdCONTRIBUTORS.md LICENSELICENSE MEMORY.mdMEMORY.md MakefileMakefile Makefile.gnuMakefile.gnu README.mdREADME.md SPEC_AUDIT.mdSPEC_AUDIT.md packages.jsonpackages.json spec.jsonspec.json View all filesRepository files navigationREADMEContributingApache-2.0 licensenanolang A minimal, LLM-friendly programming language with mandatory testing and unambiguous syntax. Self-hosting: NanoLang supports true self-hosting via a Stage 0 → Stage 1 → Stage 2 bootstrap (make bootstrap); see planning/SELF_HOSTING.md. Quick Start bin/nanoc - NanoLang compiler (transpiles to C) Hello World shadow greet { fn main() -> int { shadow main { Run it: Ubuntu 22.04+ (x86_64) Tier 2: Windows via WSL 🪟 macOS Intel (via Rosetta 2 on Apple Silicon, or native on older Macs) Key Features Prefix Notation - No operator precedence: (+ a (* b c)) is always clear Documentation User Guide (HTML) - Progressive tutorial + executable snippets Key Topics Standard Library - Built-in functions Language Overview # Functions with mandatory tests shadow add { # Control flow # Loops Why Prefix Notation? Type System # Composite types # Generic lists # First-class functions # Generic unions (NEW!) let success: Result<int, string> = Result.Ok { value: 42 } Standard Library fn divide(a: int, b: int) -> Result<int, string> { fn main() -> int { /* Note: Result helper functions (is_ok/unwrap/etc) are planned once return 0 Examples hello.nano - Basic structure Game Examples snake_ncurses.nano - Classic snake with NCurses UI See examples/README.md for the complete list. ncurses - Terminal UI (interactive games, text interfaces) Modules automatically install dependencies via package managers (Homebrew, apt, etc.) when first used. See docs/MODULE_SYSTEM.md for details. # Run full test suite # Quick test (language tests only) # Build all examples # Launch the examples browser # Validate user guide snippets (extract → compile → run) # Build static HTML for the user guide # Serve the user guide locally (dev) # Clean build # Install to /usr/local/bin (override with PREFIX=...) MEMORY.md - Complete LLM training reference with patterns, idioms, debugging workflows, and common errors Quick LLM Bootstrap Read MEMORY.md first - covers syntax, patterns, testing, debugging The combination of MEMORY.md (practical guidance) + spec.json (formal reference) provides complete coverage for code generation and understanding. Add examples and tutorials See CONTRIBUTING.md for guidelines. ✅ Complete language implementation (lexer, parser, typechecker, transpiler) See docs/ROADMAP.md for future plans. LLM Code Generation - Unambiguous syntax reduces AI errors Design Philosophy: Minimal syntax (18 keywords vs 32 in C) License Documentation: docs/
About A tiny experimental language designed to be targeted by coding LLMs domain-lang new-language-design domain-ai llm thought-exercise vibe-coding Resources Readme Apache-2.0 license Contributing Contributing Uh oh! There was an error while loading. Please reload this page. Activity 194 4 11 Report repository Releases v2.0.8 Latest Packages No packages published Contributors jordanhubbard
factory-droid[bot]
claude
Copilot
Languages C Shell Python Gnuplot C++ CSS Other Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. |
NanoLang is a minimalist, experimental programming language designed to serve as an optimal target for coding large language models (LLMs). Created by Jordan Hubbard, the project emphasizes unambiguous syntax, mandatory testing, and performance through transpilation to C. Its design prioritizes simplicity, readability, and compatibility with AI-driven code generation while maintaining native execution efficiency. The language’s structure reflects a deliberate balance between human-friendly conventions and the precision required for reliable LLM interactions. NanoLang’s core philosophy revolves around reducing ambiguity in syntax, enforcing rigorous testing practices, and leveraging existing ecosystems for portability and extensibility. The language’s syntax is built around prefix notation, eliminating the need for operator precedence rules that often confuse both humans and AI systems. For example, expressions like `(+ a (* b c))` explicitly define operations without relying on implicit order-of-operations logic. This approach ensures clarity, which is critical for LLMs generating code that must be both correct and predictable. Additionally, NanoLang enforces mandatory testing through "shadow tests," requiring every function to be accompanied by a corresponding test block. These tests are integrated directly into the language, ensuring that code quality is maintained throughout development. The shadow test framework allows developers to assert expected outcomes using a simple syntax, such as `(assert (== (add 2 3) 5))`, which verifies the correctness of functions like `add` in the provided Hello World example. Static typing with type inference is another cornerstone of NanoLang’s design. The language supports primitive types like `int`, `float`, `bool`, and `string`, as well as composite types such as structs, enums, and generic unions. For instance, the `Result<T, E>` union pattern enables robust error handling by distinguishing between success (`Ok`) and failure (`Err`) states. This type system is designed to catch errors at compile time, reducing runtime issues and improving reliability. The use of generics further enhances flexibility, allowing developers to create reusable code structures like `List<int>` for type-safe collections. Immutable variables are the default, with mutability explicitly declared using `let mut`, promoting safer and more predictable code. NanoLang’s transpilation to C ensures native performance while maintaining compatibility with existing toolchains. By converting high-level constructs into C code, the language leverages the efficiency of compiled languages without sacrificing ease of use. This approach also facilitates integration with C libraries through a module system that supports automatic dependency management. Modules like `ncurses` and `sdl` provide access to terminal UI, graphics, and audio functionalities, with dependencies automatically installed via package managers like Homebrew or apt. The module system is designed to streamline development, allowing developers to focus on application logic rather than infrastructure setup. The project includes a growing standard library with utilities for string manipulation, mathematical operations, and error handling. For example, the `divide` function demonstrates the use of `Result<T, E>` to handle division by zero gracefully, returning an error message instead of causing a crash. While the standard library is still evolving, its design emphasizes modularity and extensibility, enabling developers to build complex applications with minimal boilerplate. The language also supports first-class functions, allowing for functional programming patterns such as higher-order functions and closures. NanoLang’s documentation is comprehensive, featuring a user guide with executable code snippets, a language specification, and tutorials for common tasks. The user guide serves as both a learning resource and a reference, with examples that demonstrate syntax, control flow, and advanced features like recursion and pattern matching. The project also provides a suite of examples, ranging from basic arithmetic operations to full-featured games like Snake and Conway’s Game of Life. These examples are designed to be runnable, helping developers understand how to apply NanoLang’s features in real-world scenarios. Platform support is divided into three tiers: Tier 1 includes Ubuntu, macOS, and FreeBSD with full testing and support; Tier 2 covers Windows via WSL2, which provides a Linux environment for running NanoLang without native Windows binaries; and Tier 3 includes experimental platforms like macOS Intel and other Linux distributions, which may require manual configuration. This tiered approach ensures that the language is accessible across a wide range of systems while maintaining stability on supported platforms. The project’s development process emphasizes self-hosting, with a three-stage bootstrap process (`Stage 0 → Stage 1 → Stage 2`) that allows the compiler to be written in NanoLang itself. This self-hosting capability is documented in `planning/SELF_HOSTING.md`, highlighting the language’s maturity and its potential for use in compiler development. The build system, managed through Makefiles, supports tasks like compiling the language, running tests, and generating documentation. Developers can also extend the toolchain by contributing new modules or improving existing ones, with clear guidelines provided in `CONTRIBUTING.md`. NanoLang’s design reflects a focus on teaching LLMs to generate correct and idiomatic code. The `MEMORY.md` file serves as a training reference, outlining patterns, debugging workflows, and common pitfalls for AI systems. The `spec.json` file provides a formal specification of the language’s syntax, types, and standard library functions, ensuring consistency for both human developers and AI models. By combining practical guidance with formal definitions, NanoLang aims to bridge the gap between human-centric programming and machine-generated code. The project’s current status is described as production-ready, with a fully implemented compiler that supports all core features. Completed milestones include a complete language implementation (lexer, parser, typechecker, transpiler), static typing with inference, and a robust module system. The language also includes 49+ standard library functions and 90+ working examples, demonstrating its versatility for both simple scripts and complex applications. Future plans, outlined in `docs/ROADMAP.md`, suggest further enhancements to the standard library, improved tooling, and expanded platform support. NanoLang addresses three primary challenges: reducing errors in AI-generated code through unambiguous syntax, enforcing testing discipline to improve reliability, and delivering performance comparable to compiled languages. Its minimal syntax—18 keywords compared to 32 in C—simplifies learning while maintaining expressiveness. The language’s design philosophy emphasizes simplicity, consistency, and integration with existing ecosystems, making it a compelling choice for developers seeking to leverage LLMs in their workflows. By combining these elements, NanoLang represents a novel approach to programming language design that prioritizes both human and machine readability. |