This page is an English fallback. I have not published a 中文 translation of this generated reference yet.

Examples#

I have 248 NanoLang examples on disk. This table is generated from those files; I do not maintain a second count by hand.

ExampleSourceTrackBuildPurpose
Datetime Library Demoexamples/advanced/datetime_demo.nanomoduleslocal, external-depsDemonstrate date and time operations using the datetime module
Error Handling Patternsexamples/advanced/error_handling_patterns.nanounclassifiedunspecifiedDemonstrate comprehensive error handling strategies in NanoLang
libevent Timed Loop Exitexamples/advanced/event_example.nanomodulesexternal-depsSchedule an event-loop exit and dispatch until that timeout expires
FFI (Foreign Function Interface) Tutorialexamples/advanced/ffi_tutorial.nanounclassifiedunspecifiedStep-by-step guide to calling C functions from NanoLang
Libc Module Demoexamples/advanced/libc_demo.nanounclassifiedunspecifiedDemonstrate calling C standard library functions through the libc module
Assert With Taskexamples/advanced/mac_assert_with_task.nanounclassifiedunspecifiedDemonstrate automatic issue creation from failed assertions using MAC tasks
MAC Task Basic Usageexamples/advanced/mac_basic_usage.nanounclassifiedunspecifiedDemonstrate querying and creating MAC tasks for programmatic issue management
MAC Workflow Automationexamples/advanced/mac_workflow_automation.nanounclassifiedunspecifiedDemonstrate programmatic issue management and automated triage with MAC tasks
Extended Math Functions Demoexamples/advanced/math_ext_demo.nanounclassifiedunspecifiedDemonstrate scientific calculations using extended math module functions
Math Helper Moduleexamples/advanced/math_helper.nanointernalmoduleProvide basic arithmetic helper functions as a reusable module
Module Introspection Demoexamples/advanced/module_introspection_demo.nanounclassifiedunspecifiedDemonstrate querying module metadata at compile-time using introspection
Namespace System Demoexamples/advanced/namespace_demo.nanounclassifiedunspecifiedDemonstrate NanoLang's namespace system with public/private visibility
Performance Optimization Techniquesexamples/advanced/performance_optimization.nanounclassifiedunspecifiedDemonstrate performance best practices in NanoLang
Regex Demo (Full)examples/advanced/regex_demo.nanounclassifiedunspecifiedShowcase both one-shot and compiled regex operations with tiered API
Regex Demo (Simple)examples/advanced/regex_demo_simple.nanounclassifiedunspecifiedDemonstrate one-shot regex operations with a simple Pythonic API
SQLite Prepared CRUDexamples/advanced/sqlite_simple.nanomodulesexternal-depsCreate, read, update, and delete rows with prepared statements and bound values
File Processorexamples/advanced/stdio_file_processor.nanounclassifiedunspecifiedDemonstrate file reading, filtering, transforming, and writing with the stdio module
AST Module Demoexamples/advanced/stdlib_ast_demo.nanounclassifiedunspecifiedDemonstrate programmatic AST node creation and metaprogramming capabilities
Testing Strategies and Best Practicesexamples/advanced/testing_strategies.nanounclassifiedunspecifiedComprehensive guide to writing effective shadow tests
UI Code Display Demoexamples/advanced/ui_code_display_demo.nanounclassifiedunspecifiedDemonstrate a graphical code display widget using SDL and TTF rendering
Unicode String Operations Demoexamples/advanced/unicode_demo.nanounclassifiedunspecifiedDemonstrate grapheme-aware unicode string handling and operations
Unsafe Blocks Demoexamples/advanced/unsafe_demo.nanounclassifiedunspecifiedDemonstrate the unsafe keyword for marking potentially dangerous operations
libuv Loop Inspectionexamples/advanced/uv_example.nanomodulesexternal-depsCreate an empty libuv loop, poll it without blocking, and close it
Vector2D Module Demoexamples/advanced/vector2d_demo.nanounclassifiedunspecifiedDemonstrate 2D vector mathematics using the vector2d module
Vector2D Physics Simulationexamples/advanced/vector2d_physics_simple.nanounclassifiedunspecifiedDemonstrate a simple 2D physics simulation with gravity and collision
IPC Message Schemaexamples/agentos_ipc_schema.nanoapplicationslocalI model a small IPC envelope with explicit concrete message records
Offline Issue Triageexamples/ai_github_agent.nanoapplicationslocalI show deterministic issue prompt construction without contacting GitHub or an LLM
Array Utils API Lessonexamples/api_lessons/array_utils_api.nanomoduleslocalI show the focused array utility API for sorting strings
Audio Helpers API Lessonexamples/api_lessons/audio_helpers_api.nanomodulesexternal-deps, audioI show the raw PCM to WAV helper call with deterministic missing-input behavior
Binary API Lessonexamples/api_lessons/binary_api.nanomoduleslocalI show binary encode and decode helpers with Result-returning reads
Collections HashMap API Lessonexamples/api_lessons/collections_hashmap_api.nanomoduleslocalI show my string HashMap wrapper, including traversal, mutation, and explicit cleanup
Set API Lessonexamples/api_lessons/collections_set_api.nanomoduleslocalI show the string Set API with add, membership, values, remove, and clear
std::diagnostics API Lessonexamples/api_lessons/diagnostics_api.nanomoduleslocalI show building Loc/Span/Diagnostic values and formatting an error report
dispatch API Lessonexamples/api_lessons/dispatch_api.nanomodulesexternal-depsI show creating a serial queue, dispatching async work, and synchronising via group_wait
Environment API Lessonexamples/api_lessons/env_api.nanomoduleslocalI show environment variable and argv access
Examples Diagnostic API Lessonexamples/api_lessons/examples_diag_api.nanomoduleslocalI emit JSON-line diagnostics for examples that need machine-readable status.
Filesystem API Lessonexamples/api_lessons/fs_api.nanomoduleslocalI show path helpers, glob matching, and a deterministic file round trip
GLUT Helpers API Lessonexamples/api_lessons/glut_helpers_api.nanomodulesexternal-deps, graphicalI show the GLUT helper calls that should run only after an OpenGL context exists.
std::json API Lessonexamples/api_lessons/json_api.nanomoduleslocalI show parsing a small JSON document, reading typed fields, and round-tripping back to string
std::log API Lessonexamples/api_lessons/log_api.nanomoduleslocalI show configuring log level, writing info/warn/error, and reading the level back
std::math::array_ops API Lessonexamples/api_lessons/math_array_ops_api.nanomoduleslocalI show elementwise array math, reductions, normalization, and distance helpers.
std::math::complex API Lessonexamples/api_lessons/math_complex_api.nanomoduleslocalI show complex arithmetic in rectangular and polar form.
math_ext API Lessonexamples/api_lessons/math_ext_api.nanomoduleslocalI show the extern-FFI math_ext bindings for inverse trig, logs, hyperbolics, and floats
std::math::extended API Lessonexamples/api_lessons/math_extended_api.nanomoduleslocalI show extended math helpers: trig, logs, constants, and angle conversion
std::math::Mat4 API Lessonexamples/api_lessons/math_matrix4_api.nanomoduleslocalI show 4x4 transforms for points and directions.
std::math::Quat API Lessonexamples/api_lessons/math_quaternion_api.nanomoduleslocalI show quaternion construction, normalization, multiplication, and vector rotation.
std::math::Vector2D API Lessonexamples/api_lessons/math_vector2d_api.nanomoduleslocalI show the std::math 2D vector API with pure functions and reflection
std::math::Vector3D API Lessonexamples/api_lessons/math_vector3d_api.nanomoduleslocalI show 3D vector arithmetic for geometry and physics code.
std::math::Vector4D API Lessonexamples/api_lessons/math_vector4d_api.nanomoduleslocalI show homogeneous coordinates and 4D vector helpers.
Nano Highlight API Lessonexamples/api_lessons/nano_highlight_api.nanomoduleslocalI show HTML and ANSI syntax highlighting for small NanoLang snippets
std::peg2 API Lessonexamples/api_lessons/peg2_api.nanomoduleslocalI show compiling a named PEG2 grammar, parsing input, and reading rule_name + span
std::peg API Lessonexamples/api_lessons/peg_api.nanomoduleslocalI show one-shot pattern matching and capture extraction with the minimal PEG engine
Preferences API Lessonexamples/api_lessons/preferences_api.nanomodulesexternal-depsI show playlist preference save/load and preference path helpers
Process API Lessonexamples/api_lessons/process_api.nanomoduleslocalI show process execution, exit codes, spawned processes, and pipe cleanup
proptest API Lessonexamples/api_lessons/proptest_api.nanomoduleslocalI show one tiny forall_int run with a trivial integer property
pt2_audio API Lessonexamples/api_lessons/pt2_audio_api.nanomodulesexternal-depsI show the ProTracker audio playback surface without requiring a real MOD file.
pt2_module API Lessonexamples/api_lessons/pt2_module_api.nanomodulesexternal-depsI show the ProTracker MOD-file API surface (load/info/free) without requiring a real file
PT2 State API Lessonexamples/api_lessons/pt2_state_api.nanomodulesexternal-deps, audioI show ProTracker playback, position, channel, pattern, and sample state calls
PyBridge API Lessonexamples/api_lessons/pybridge_api.nanomodulesexternal-depsI show Python bridge initialization, import, call, get, set, release, and shutdown
PyBridge Matplotlib API Lessonexamples/api_lessons/pybridge_matplotlib_api.nanomodulesexternal-depsI show the matplotlib bridge rendering call with an inline PNG response
Result API Lessonexamples/api_lessons/result_api.nanomoduleslocalI show the generic Result union as a small success-or-error contract
SDL_image Safe API Lessonexamples/api_lessons/sdl_image_safe_api.nanomodulesexternal-deps, graphicalI use the safe SDL_image wrappers so example code does not carry unsafe blocks at each texture call.
std::lib API Lessonexamples/api_lessons/std_lib_api.nanomoduleslocalI show the standard library root import and its version constant.
Stdio API Lessonexamples/api_lessons/stdio_api.nanomoduleslocalI show stdio file handles through safe size/existence helpers and raw close
StringBuilder API Lessonexamples/api_lessons/stringbuilder_api.nanomoduleslocalI show efficient string construction without repeated raw concatenation
stdlib::tidy API Lessonexamples/api_lessons/tidy_api.nanomoduleslocalI show the legacy stdlib/tidy.nano code-formatter helpers
Vector2D API Lessonexamples/api_lessons/vector2d_api.nanomoduleslocalI show 2D vector construction, arithmetic, and a small interpolated path
WebSocket API Lessonexamples/api_lessons/websocket_api.nanomoduleslocalI show the WebSocket client handle lifecycle without requiring a live server
Nanoamp Playlist Harnessexamples/audio/nanoamp_playlist_harness.nanounclassifiedunspecifiedNo purpose metadata yet.
SDL Audio Playerexamples/audio/sdl_audio_player.nanounclassifiedgraphical, external-depsInteractive audio player with music playback, sound effects, and volume control using SDL_mixer
WAV Audio Playbackexamples/audio/sdl_audio_wav.nanounclassifiedexternal-deps, audioPlays a user-provided WAV file using SDL_mixer to verify audio output
MOD Audio Visualizerexamples/audio/sdl_mod_visualizer.nanounclassifiedgraphical, external-depsPlays MOD tracker files with real-time waveform, VU meters, and multiple visualization modes
NanoAmp Music Playerexamples/audio/sdl_nanoamp.nanounclassifiedgraphical, external-depsPixel-perfect Winamp tribute with playlist management, directory browsing, and audio visualizations
ProTracker Cloneexamples/audio/sdl_tracker_shell.nanounclassifiedgraphical, external-depsFull-featured ProTracker-style MOD player with file browser, ModArchive search, pattern viewer, and audio visualizations
Bench sampleexamples/bench_sample.nanointernallocalTwo tiny zero-parameter workloads for nanoc --bench
Cross Backend Helloexamples/cross_backend/hello_cross_backend.nanolearnlocalProvide one small program suitable for native, VM, and WASM backend smoke tests
JSON Demoexamples/data/json_demo.nanomoduleslocalDemonstrates JSON parsing, creation, and array manipulation using the json module
Coverage Demoexamples/debug/coverage_demo.nanounclassifiedunspecifiedDemonstrates coverage tracking and execution tracing using the stdlib coverage API
Logging Demoexamples/debug/logging_demo.nanounclassifiedunspecifiedI show every structured log level and use categories to trace a calculation
Property Test Mathexamples/debug/property_test_math.nanounclassifiedunspecifiedProperty-based testing of algebraic properties for addition, multiplication, abs, and max
Property Test Sortingexamples/debug/property_test_sorting.nanounclassifiedunspecifiedProperty-based testing of bubble sort verifying length preservation, ordering, and idempotence
LLM Diagnostics Type Mismatchexamples/diagnostics/llm_diags_type_mismatch.nanoexperimentalexpected-failureProvide an expected-failure input for --llm-diags-json
Emacs buffer helpersexamples/emacs/emacs_buffer.nanointernallocalPoint, region, and text reconstruction for the SDL editor
Emacs keymap helpersexamples/emacs/emacs_keys.nanointernallocalPrefix keymap for the SDL Nano Emacs editor
Initexamples/emacs/init.nanounclassifiedunspecifiedNo purpose metadata yet.
Nano Emacsexamples/emacs/nano_emacs.nanoshowcasegraphical, external-depsWindowed SDL editor with NanoLang as the extension language
CUDA Fluid Simulationexamples/fluid_sim.nanoapplicationsexternal-depsGPU-accelerated 2D fluid simulation using NVIDIA Warp via the Python bridge
Asteroidsexamples/games/sdl_asteroids.nanounclassifiedunspecifiedFull arcade Asteroids game with lives, score, asteroid breaking mechanics, and thrust physics
Checkersexamples/games/sdl_checkers.nanounclassifiedunspecifiedFull-featured checkers game with AI opponent, king pieces, mandatory jumps, and multi-jump support
Pongexamples/games/sdl_pong.nanounclassifiedunspecifiedTwo-player Pong game with authentic 1972 style, blocky score display, and UI widget controls
OpenCL Julia Flowexamples/gpu/julia_flow.nanoshowcaseAnimate a dense Julia set on CUDA or OpenCL and show it as an SDL texture
GPU Matrix Operationsexamples/gpu/matmul.nanomodulesgpu, external-depsDemonstrate 2D GPU launch patterns over matrix-shaped data
GPU Reduce Sumexamples/gpu/reduce_sum.nanomodulesgpu, external-depsDemonstrate a parallel reduction using GPU atomics
GPU SAXPYexamples/gpu/saxpy.nanomodulesgpu, external-depsDemonstrate the SAXPY benchmark pattern on the GPU
GPU Vector Addexamples/gpu/vector_add.nanomodulesgpu, external-depsShow the smallest useful GPU vector kernel
GPU Vector Scaleexamples/gpu/vector_scale.nanomodulesgpu, external-depsDemonstrate one-load one-store GPU scaling
Boids Flocking Simulation (Parallel)examples/graphics/sdl_boids.nanounclassifiedunspecifiedVisual flocking simulation with parallel force computation via dispatch groups
SDL Drawing Primitivesexamples/graphics/sdl_drawing_primitives.nanounclassifiedunspecifiedDemonstrates SDL rectangle drawing and basic rendering functions
Falling Sand Simulation (Parallel Physics)examples/graphics/sdl_falling_sand.nanounclassifiedunspecifiedInteractive cellular automata physics sandbox with parallel column-strip updates
Fire Effectexamples/graphics/sdl_fire.nanounclassifiedunspecifiedClassic demoscene fire simulation with palette-based heat propagation and cooling
Forth IDEexamples/graphics/sdl_forth_ide.nanounclassifiedunspecifiedSplit-pane SDL terminal IDE for the NanoLang Forth interpreter
Game of Life (SDL)examples/graphics/sdl_game_of_life.nanounclassifiedunspecifiedConway's Game of Life cellular automaton with colorful cell aging visualization
Glass Sphere Raytracerexamples/graphics/sdl_glass_sphere.nanounclassifiedunspecifiedReal-time raytracer with refraction, Fresnel reflections, and a checkerboard plane
SDL_image Complete Demoexamples/graphics/sdl_image_demo.nanounclassifiedunspecifiedI introduce SDL_image loading, scaling, rotation, flipping, tinting, and alpha blending in one window
Sprite Sheet Animationexamples/graphics/sdl_image_sprite_animation.nanographicsgraphical, external-depsSelect timed source rectangles from one PNG sprite sheet
Tiled Scrolling Backgroundexamples/graphics/sdl_image_tiled_background.nanounclassifiedunspecifiedDemonstrates tiled repeating backgrounds with scrolling using SDL_image
Mouse Click Testexamples/graphics/sdl_mouse_click.nanounclassifiedunspecifiedTests mouse click event detection alongside keyboard event polling
NanoViz 3D Music Visualizerexamples/graphics/sdl_nanoviz.nanounclassifiedunspecifiedI combine SDL audio levels with five OpenGL visualizations.
Particle Explosionsexamples/graphics/sdl_particles.nanounclassifiedunspecifiedInteractive particle system where mouse clicks spawn colorful explosions with gravity
2D Physics Simulationexamples/graphics/sdl_physics_demo.nanounclassifiedunspecifiedReal-time bouncing ball simulation with gravity, collisions, and elasticity
Whitted-Style Ray Tracerexamples/graphics/sdl_raytracer.nanounclassifiedunspecifiedClassic recursive raytracer with real-time reflections, shadows, and interactive camera
Starfield Hyperspaceexamples/graphics/sdl_starfield.nanounclassifiedunspecifiedStar Wars-style hyperspace starfield with stars flying from center outward with motion trails
Procedural Terrain Explorerexamples/graphics/sdl_terrain_explorer.nanounclassifiedunspecifiedInfinite procedural terrain with Perlin noise, biomes, fog of war, and camera controls
SDL Streaming Textureexamples/graphics/sdl_texture_demo.nanomodulesgraphical, external-depsUpload and render a new ARGB8888 pixel pattern every frame
Extended UI Widgetsexamples/graphics/sdl_ui_widgets_extended.nanounclassifiedunspecifiedShowcases all UI widgets including buttons, sliders, text input, dropdowns, spinners, and tooltips
Hello Packageexamples/hello_pkg/main.nanomoduleslocalShow the smallest package with a nano.toml manifest and a real entry point
Deterministic File Pipelineexamples/integration/file_pipeline.nanolearnlocalWrite fixed local input, read it, transform it, and verify the output file
Full-Featured REPLexamples/language/full_repl.nanounclassifiedunspecifiedComprehensive REPL with persistent variables, function definitions, multi-line input, and multi-type evaluation
Six-script greetingexamples/language/i18n_six_scripts.nanounclassifiedunspecifiedUTF-8 string literals in English, Mandarin, Hindi, Spanish, Arabic, and French
Advanced Math Functionsexamples/language/nl_advanced_math.nanounclassifiedunspecifiedDemonstrates built-in math functions including sqrt, pow, rounding, and trigonometry
Affine Resource Demoexamples/language/nl_affine_resource_demo.nanolearnlocalI transfer and dismantle a simulated file handle
Array Bounds Checkingexamples/language/nl_array_bounds.nanounclassifiedunspecifiedDemonstrates runtime bounds checking for array access in compiled code
Array Completeexamples/language/nl_array_complete.nanounclassifiedunspecifiedComprehensive test suite covering all array operations including literals, access, length, and creation
Array Functional Patternsexamples/language/nl_array_functional.nanounclassifiedunspecifiedDemonstrates transform, predicate, and reduction patterns on arrays
Array Inferenceexamples/language/nl_array_infer.nanolearnlocalShow array element type inference from literals
Boids Flocking Simulationexamples/language/nl_boids.nanoshowcaselocalSimulates emergent flocking behavior using cohesion forces, speed limiting, and world wrapping
Calculatorexamples/language/nl_calculator.nanounclassifiedunspecifiedArithmetic operation dispatcher demonstrating function composition and string formatting
Checked Math Demoexamples/language/nl_checked_math_demo.nanounclassifiedunspecifiedDemonstrates safe arithmetic operations that catch overflow, underflow, and division by zero at runtime
Comparison Operatorsexamples/language/nl_comparisons.nanounclassifiedunspecifiedDemonstrate all comparison operators and boolean logic in prefix notation
For Loopsexamples/language/nl_control_for.nanounclassifiedunspecifiedDemonstrate for-in loops with ranges, nested for loops, and accumulator patterns
If/Else and While Loopsexamples/language/nl_control_if_while.nanounclassifiedunspecifiedComprehensive tests of if/else branching, while loops, nested loops, and combined control flow
Match Expressionsexamples/language/nl_control_match.nanounclassifiedunspecifiedComprehensive demonstration of match expressions on union types for pattern matching
CSV Employee Processorexamples/language/nl_csv_processor.nanounclassifiedunspecifiedDemonstrates a filter-map-fold pipeline on employee data for payroll processing and analytics
Data Analytics Engineexamples/language/nl_data_analytics.nanounclassifiedunspecifiedBuilds a complete analytics pipeline using map and reduce for functional data processing
Self-Hosting Demoexamples/language/nl_demo_selfhosting.nanounclassifiedunspecifiedDemonstrates import aliases and modular code composition as a foundation for self-hosting compilation
Dispatch Counterexamples/language/nl_dispatch_counter.nanomodulesexternal-depsDemonstrate the dispatch queue API shape with a simple counter workload
Dispatch Pipelineexamples/language/nl_dispatch_pipeline.nanomodulesexternal-depsDemonstrate fan-out and fan-in with dispatch queues
Dispatch Statsexamples/language/nl_dispatch_stats.nanomodulesexternal-depsDemonstrate serialized state updates through a dispatch queue
Enumsexamples/language/nl_enum.nanounclassifiedunspecifiedDemonstrate enum definition with auto and explicit values, and enum-to-int conversion
Extern Character Functionsexamples/language/nl_extern_char.nanounclassifiedunspecifiedDemonstrates calling C character classification and conversion functions via extern declarations
Extern Math Functionsexamples/language/nl_extern_math.nanounclassifiedunspecifiedDemonstrates calling C math library functions via extern declarations for trig, exponential, and rounding
Extern String Functionsexamples/language/nl_extern_string.nanounclassifiedunspecifiedDemonstrates calling safe C string functions (strlen, strcmp, strncmp) via extern declarations
Factorialexamples/language/nl_factorial.nanounclassifiedunspecifiedDemonstrate recursive function calls and shadow testing
Falling Sand Simulationexamples/language/nl_falling_sand.nanounclassifiedunspecifiedSimulates particle physics with gravity and collision using a grid-based cellular automata approach
Fibonacci Sequenceexamples/language/nl_fibonacci.nanounclassifiedunspecifiedClassic recursive algorithm with multiple base cases
Filter, Map, and Foldexamples/language/nl_filter_map_fold.nanounclassifiedunspecifiedDemonstrates classic functional programming patterns using first-class functions
First-Class Functionsexamples/language/nl_first_class_functions.nanounclassifiedunspecifiedDemonstrates passing functions as parameters to higher-order functions
Float Operationsexamples/language/nl_floats.nanounclassifiedunspecifiedDemonstrates floating-point arithmetic, math functions, and circle area calculation
For-In Arrayexamples/language/nl_for_in_array.nanolearnlocalDemonstrate for-in iteration over dynamic arrays
Forth Interpreter (FIG Forth 83)examples/language/nl_forth_interpreter.nanounclassifiedunspecifiedComplete implementation of the FIG Forth 83 standard word set as an interactive interpreter
Function Factories v2examples/language/nl_function_factories_v2.nanounclassifiedunspecifiedDemonstrates function factories that return functions and apply them via higher-order helpers
Function Return Valuesexamples/language/nl_function_return_values.nanounclassifiedunspecifiedDemonstrates functions that return other functions as values
Function Variablesexamples/language/nl_function_variables.nanounclassifiedunspecifiedDemonstrates storing functions in variables, calling them, and passing them around
Functions (Basic)examples/language/nl_functions_basic.nanounclassifiedunspecifiedDemonstrate function definition, parameters, return values, recursion, and function composition
Conway's Game of Lifeexamples/language/nl_game_of_life.nanounclassifiedunspecifiedSimulates cellular automata with birth, death, and survival rules on a 2D grid
Generics Demoexamples/language/nl_generics_demo.nanounclassifiedunspecifiedComprehensive demonstration of NanoLang's generic type system using List<T> with monomorphization
Global Counterexamples/language/nl_global_counter.nanomodulesexternal-depsDemonstrate module-scope mutable state guarded by dispatch support
HashMapexamples/language/nl_hashmap.nanounclassifiedunspecifiedDemonstrates basic HashMap creation, insertion, lookup, and size operations
HashMap Word Countexamples/language/nl_hashmap_word_count.nanounclassifiedunspecifiedDemonstrates using HashMap to count word occurrences in an array of strings
Hello Worldexamples/language/nl_hello.nanounclassifiedunspecifiedThe traditional first program - verify your NanoLang installation works
Logical Operatorsexamples/language/nl_logical.nanounclassifiedunspecifiedDemonstrate boolean logic operators (and, or, not) in prefix notation
Integer Matchexamples/language/nl_match_int.nanolearnlocalDemonstrate integer literal pattern matching
Matrix Operationsexamples/language/nl_matrix_operations.nanounclassifiedunspecifiedDemonstrates 2D matrix operations using nested arrays with creation, access, sum, and scaling
Maze Generator and Solverexamples/language/nl_maze.nanounclassifiedunspecifiedGenerates a procedural maze and solves it with greedy pathfinding using grid-based data structures
Mutable Variablesexamples/language/nl_mutable.nanounclassifiedunspecifiedDemonstrate the difference between immutable (let) and mutable (let mut) variables
Arithmetic Operatorsexamples/language/nl_operators.nanounclassifiedunspecifiedDemonstrate all arithmetic operations in prefix notation
PEG2 CSVexamples/language/nl_peg2_csv.nanomoduleslocalDemonstrate parsing CSV with the PEG2 grammar module
PEG2 Expressionsexamples/language/nl_peg2_expr.nanomoduleslocalDemonstrate arithmetic expression parsing with PEG2
PEG2 JSONexamples/language/nl_peg2_json.nanomoduleslocalDemonstrate JSON structural validation with PEG2
Pi Calculatorexamples/language/nl_pi_calculator.nanounclassifiedunspecifiedComputes pi using multiple methods (Leibniz, Machin's formula, C math library) with configurable precision
High-Precision Pi (Machin's Formula)examples/language/nl_pi_chudnovsky.nanounclassifiedunspecifiedCalculates pi to up to 1000 decimal places using Machin's formula with timing and verification
Prime Numbersexamples/language/nl_primes.nanounclassifiedunspecifiedChecks primality and lists prime numbers using trial division with shadow tests
Prime Sieve (Eratosthenes)examples/language/nl_primes_sieve.nanounclassifiedunspecifiedI replace the trial division from nl_primes with a sieve for the million-number benchmark
Random Sentence Generatorexamples/language/nl_random_sentence.nanounclassifiedunspecifiedGenerates random nonsense sentences by reading words from the system dictionary
Result Propagationexamples/language/nl_result_propagation.nanolearnlocalDemonstrate Result values and explicit short-circuit error propagation
Snake Gameexamples/language/nl_snake.nanounclassifiedunspecifiedImplements a text-based snake game with AI-controlled movement, collision detection, and scoring
String Interpolationexamples/language/nl_string_interp.nanolearnlocalDemonstrate f-string interpolation and automatic value conversion
String Operationsexamples/language/nl_string_operations.nanounclassifiedunspecifiedDemonstrates character access, classification, and conversion functions on strings
Structsexamples/language/nl_struct.nanounclassifiedunspecifiedDemonstrate struct definition, instantiation, field access, and passing structs to functions
Tic-Tac-Toeexamples/language/nl_tictactoe.nanounclassifiedunspecifiedImplements a text-based tic-tac-toe game with win detection, board display, and automated demo play
Runtime Tracingexamples/language/nl_tracing.nanomoduleslocalRecord function spans and named events with my tracing API
Type Systemexamples/language/nl_types.nanounclassifiedunspecifiedDemonstrate all data types in nanolang (int, float, bool, string, void)
Tuple Typesexamples/language/nl_types_tuple.nanounclassifiedunspecifiedComprehensive demonstration of tuple literals, field access, return values, and disambiguation
Union Type Constructionexamples/language/nl_types_union_construct.nanounclassifiedunspecifiedComprehensive tests for constructing union variants with fields, computed values, and pattern matching
Union Typesexamples/language/nl_union_types.nanounclassifiedunspecifiedDemonstrates tagged union (sum type) definitions with generic and non-generic variants
Unsafe Blocks Demoexamples/language/nl_unsafe_demo.nanounclassifiedunspecifiedDemonstrates unsafe blocks for marking explicit trust boundaries around FFI and unchecked operations
Word Frequency Counterexamples/language/nl_word_frequency.nanounclassifiedunspecifiedCounts word frequencies in text using a data transformation pipeline with normalization and stopword filtering
Large Project Packageexamples/large_project/main.nanomoduleslocalShow a real package entry point that imports multiple local modules
Large Project Modelsexamples/large_project/src/models.nanomoduleslocalProvide shared records for the large project package
Large Project Pricingexamples/large_project/src/pricing.nanomoduleslocalKeep price arithmetic in a package module
Example Discovery Libraryexamples/lib/example_discovery.nanointernallocalDiscover example files and parse structured metadata headers
Launcher UI Libraryexamples/lib/launcher_ui.nanointernalgraphical, external-depsRender the examples launcher UI
Process Manager Libraryexamples/lib/process_manager.nanointernallocalManage child processes for the examples launcher
Resource Monitor Libraryexamples/lib/resource_monitor.nanointernallocalRead process resource stats for launcher children
Source Editor Libraryexamples/lib/source_editor.nanointernallocalMaintain text buffers and file edits for the examples launcher
MuJoCo Cartpole Feedbackexamples/mujoco/mujoco_cartpole_balance.nanomodulesexternal-depsI read simulated state, compute a feedback control value, and apply it through MuJoCo.
MuJoCo OpenGL Cartpoleexamples/mujoco/mujoco_opengl_cartpole.nanomodulesgraphical, external-depsI load an MJCF cartpole, step it with MuJoCo, and draw body and site state with OpenGL.
MuJoCo OpenGL Drop Labexamples/mujoco/mujoco_opengl_drop_lab.nanomodulesgraphical, external-depsI step a small MuJoCo contact scene and draw the moving bodies through OpenGL.
MuJoCo OpenGL Geom Browserexamples/mujoco/mujoco_opengl_geom_browser.nanomodulesexternal-depsI draw a MuJoCo model from geom metadata instead of hard-coded body names.
MuJoCo OpenGL Robot Sorterexamples/mujoco/mujoco_opengl_robot_sorter.nanomodulesgraphical, external-depsI move balls from a source bin to a target bin while a simple MuJoCo arm performs the cycle.
MuJoCo State Auditexamples/mujoco/mujoco_state_audit.nanomodulesexternal-depsI load a model without graphics, set state and control values, and print the state I actually advanced.
Nano Tools Lintexamples/nano_tools_lint.nanotoolslocalDemonstrate source code linting and diagnostics using the nano_tools module
HTTP Hello World Serverexamples/network/http_hello_world.nanomodulesexternal-deps, interactiveDemonstrate the simplest possible HTTP server in NanoLang
Static File Serverexamples/network/http_static_server.nanomodulesexternal-deps, interactiveServe static files from a directory using the NanoLang HTTP server
OpenGL Rotating Cubeexamples/opengl/opengl_cube.nanounclassifiedunspecifiedRenders a colored rotating 3D cube using legacy OpenGL immediate mode with GLFW and GLEW
OpenGL Lit Atelierexamples/opengl/opengl_lit_atelier.nanounclassifiedunspecifiedHigh-polygon GLUT solids under four moving coloured lights
Modern OpenGL Hello Triangleexamples/opengl/opengl_modern_hello_triangle.nanounclassifiedunspecifiedRenders a colored triangle using modern OpenGL with GLSL shaders, VAO, and VBO
Modern OpenGL Postprocessexamples/opengl/opengl_modern_postprocess.nanounclassifiedunspecifiedI apply an animated screen-space wave shader to a checker texture.
OpenGL Particle Fountainexamples/opengl/opengl_particle_fountain.nanounclassifiedunspecifiedSimulates a particle fountain with gravity using GL_POINTS and alpha blending
OpenGL Solar Systemexamples/opengl/opengl_solar_system.nanounclassifiedunspecifiedRenders an animated solar system with hierarchical transforms, lighting, and materials using GLUT primitives
Utah Teapotexamples/opengl/opengl_teapot.nanounclassifiedunspecifiedRenders the iconic Utah teapot with six shader modes, interactive rotation, zoom, and on-screen HUD overlays
OPL Hello World Outputexamples/opl/examples/output/hello.nanounclassifiedunspecifiedGenerated OPL runtime skeleton that executes plan-based workflows
OPL AST Definitionsexamples/opl/opl_ast.nanounclassifiedunspecifiedDefine AST node types and shared data structures for the OPL compiler toolchain
OPL AST Buildersexamples/opl/opl_ast_builders.nanounclassifiedunspecifiedProvide builder functions for constructing OPL AST nodes as JSON objects
OPL CLIexamples/opl/opl_cli.nanocompilerlocalCommand-line interface for parsing, validating, and compiling OPL programs
OPL Code Generatorexamples/opl/opl_codegen.nanounclassifiedunspecifiedGenerate NanoLang source code from OPL AST intermediate representation
OPL Compilerexamples/opl/opl_compile.nanounclassifiedunspecifiedCompile OPL parsed AST into intermediate representation for code generation
OPL JSON Helpersexamples/opl/opl_json.nanounclassifiedunspecifiedProvide JSON utility functions for the OPL compiler toolchain
OPL Lexerexamples/opl/opl_lexer.nanounclassifiedunspecifiedTokenize OPL source code into a stream of tokens for parsing
OPL Lexer Driverexamples/opl/opl_lexer_driver.nanounclassifiedunspecifiedTest driver that exercises the OPL lexer with sample input
OPL Parserexamples/opl/opl_parser.nanounclassifiedunspecifiedParse OPL token streams into abstract syntax trees
OPL Parser Driverexamples/opl/opl_parser_driver.nanounclassifiedunspecifiedTest driver that parses an OPL file and compares AST to expected output
OPL Validatorexamples/opl/opl_validate.nanounclassifiedunspecifiedValidate OPL AST for semantic correctness and constraint checking
OPL Validate Driverexamples/opl/opl_validate_driver.nanounclassifiedunspecifiedTest driver that exercises OPL validation on sample input
Bullet Soft Body Beads (Console)examples/physics/bullet_beads_simple.nanounclassifiedunspecifiedConsole-only soft body physics test showing a deformable bead falling through an obstacle
Bullet Soft Body Beads (Visual)examples/physics/bullet_beads_visual.nanounclassifiedunspecifiedVisualizes continuous soft body beads falling through a plinko-style obstacle course using SDL
Bullet Bouncy Ballsexamples/physics/bullet_bouncy_balls.nanounclassifiedunspecifiedInteractive mouse-driven bouncy ball spawner with adjustable gravity, randomized obstacles, and a ball pit
Bullet Mega Stack Collapseexamples/physics/bullet_rigid_megastacks.nanounclassifiedunspecifiedSimulates a field of leaning block towers collapsing under gravity with real-time collapse tracking
Bullet Soft Body Beads (Modern)examples/physics/bullet_soft_body_modern.nanounclassifiedunspecifiedModernized soft body plinko simulation with continuous bead spawning through rotating obstacles
Bullet Soft Body Hourglassexamples/physics/bullet_softbody_hourglass.nanounclassifiedunspecifiedStreams of deformable soft body spheres squeeze through an hourglass funnel with particle lifecycle management
NanoLang Playground Serverexamples/playground/playground_server.nanotoolsexternal-deps, interactiveWeb-based interactive playground for writing, running, and exploring NanoLang code
Property Test Lawsexamples/properties/sort_idempotent.nanolearnlocalDemonstrate passing property tests for integer and boolean laws
Explicit Record Projectionexamples/row_poly_records.nanolanguagelocalI show the concrete record conversion used while open row types remain unsupported
Example Test Runnerexamples/run_examples.nanotoolslocalCompile and verify nanolang examples using the shared examples library
SDL Example Launcherexamples/sdl_example_launcher.nanotoolsexternal-deps, graphicalApp-store-style browser for NanoLang examples with auto-discovery, process management, and source editing
Game of Life (NCurses)examples/terminal/ncurses_game_of_life.nanounclassifiedunspecifiedConway's Game of Life cellular automaton rendered in the terminal with ncurses
Matrix Digital Rainexamples/terminal/ncurses_matrix_rain.nanounclassifiedunspecifiedIconic falling green characters effect from The Matrix rendered with ncurses
Snake Gameexamples/terminal/ncurses_snake.nanounclassifiedunspecifiedInteractive terminal snake game with scoring, food spawning, and collision detection
Test the Proof Boundaryexamples/verified/break_the_proof.nanomoduleslocalSeparate NanoCore semantic guarantees from executable function tests
Checksum Validatorexamples/verified/checksum_validator.nanounclassifiedunspecifiedTest pedagogical checksums and state their trust and integrity limits
Financial Order Validatorexamples/verified/financial_order_validator.nanounclassifiedunspecifiedTest a pedagogical pre-trade policy and state its trust boundary
Medical Dosage Calculatorexamples/verified/medical_dosage.nanounclassifiedunspecifiedTest a pedagogical dosage policy and state its trust boundary
PID Controllerexamples/verified/pid_controller.nanounclassifiedunspecifiedTest a bounded integer PID model inside the NanoCore trust boundary
Semantics Walkthroughexamples/verified/proof_trace.nanounclassifiedunspecifiedIllustrate selected formal rules without claiming to extract a Coq proof trace
Sensor Voting Systemexamples/verified/sensor_voting.nanounclassifiedunspecifiedTest a pedagogical sensor voter and state its trust boundary
Safety-Critical State Machineexamples/verified/state_machine.nanounclassifiedunspecifiedTest a pedagogical transition table inside the NanoCore trust boundary
Verified and Typecheckedexamples/verified/verified_vs_unverified.nanomoduleslocalShow what the trust report classifies without equating verification with correctness
NanoVM Example Launcherexamples/vm_example_launcher.nanotoolsnanoisaBrowse and run the sandboxed vm_*.nvm example bytecode from inside NanoVM