
C — Hello World
The classic hello-world in C — an include, main, and printf — for testing highlighters, C compilers, and parsers against the canonical first program.
- File
- C · C
- Use case
- Syntax highlightingCode parsing+1
The source-code category is a syntax-highlighting, linting, and parser fixture set: idiomatic hello-worlds plus realistic snippets across many languages, all original and documented. HTML, CSS, JavaScript, and TypeScript (shipped as .mts to sidestep the MPEG-TS .ts collision) cover the web front-end; Python, Ruby, PHP, and Shell the scripting side; Java, Kotlin, Swift, Go, and Rust the application languages; C and C++ the systems layer; SQL the database; and Wave G adds Julia, Haskell, Lua, R, Clojure, Fortran, and Nim. Intentionally invalid lint fixtures are clearly labelled. A tiny multi-language monorepo ZIP accompanies the set for unpack-then-lint pipelines. Everything text-previewable opens in the in-browser editor.
Filter source code on Browse · 125 files · 31 subcategories

The classic hello-world in C — an include, main, and printf — for testing highlighters, C compilers, and parsers against the canonical first program.

A realistic C program: a singly linked list with a typedef struct, malloc/free memory management, pointer walking, and error handling — for testing highlighters, compilers, and static analysers.

C struct SAMPLE for clangd / highlighter fixtures.

Intentionally invalid Clojure (unbalanced forms) for clj-kondo-style tests.

Minimal Clojure hello for CIDER / clj-kondo fixtures.

Clojure reduce utility — realistic snippet.

Clojure thread-first macro for highlighter tests.

The classic hello-world in C++ — iostream and std::cout — for testing highlighters, C++ compilers, and parsers.

A realistic C++ snippet with a class template, STL algorithms (max_element, accumulate), std::move, and range handling — for testing highlighters, g++/clang++, and parsers against real templates.

C++17 optional SAMPLE for clangd fixtures.

A small C# iterator Fibonacci utility — realistic snippet for language tooling.

Idiomatic C# hello-world for syntax highlighters and Roslyn-style parsers.

C# LINQ chain SAMPLE for Roslyn fixtures.

Intentionally lint-bait SAMPLE csharp snippet (empty-catch-invalid) for rule-engine tests.

A realistic component stylesheet using custom properties, flexbox, a fluid clamp() font size, color-mix(), a keyframe animation, and a media query — for testing CSS parsers, linters (stylelint), and highlighters.

A minimal stylesheet that centres a heading with grid — the simplest useful CSS file for testing highlighters, CSS parsers, and minifiers.

Tiny Dart class with a counter — fixture for Dart analysis servers.

Dart async Future SAMPLE for analysis-server tests.

Minimal Dart hello-world for Flutter/Dart IDE and highlight tests.

Elixir GenServer stub SAMPLE for Beam tooling.

Elixir module hello — for Beam/Elixir syntax and formatter smoke tests.

Elixir pipe-operator snippet for AST and formatter fixtures.

Intentionally invalid Fortran for compiler error fixtures.

Minimal Fortran 90 hello for gfortran / highlighter fixtures.

Fortran module with a pure-ish helper for module parsers.

Fortran do-loop sum — realistic numerical snippet.

The classic hello-world in Go — package main, an import, and fmt.Println, tab-indented like gofmt — for testing highlighters, the Go compiler, and parsers.

Intentionally invalid Go syntax for gofmt/parser failure tests.

A realistic Go program: a worker pool with structs and methods, goroutines, buffered channels, and a sync.WaitGroup — tab-indented like gofmt, for testing highlighters, go vet, and parsers.

Go generics helper for gopls / highlighter fixtures.

Intentionally lint-bait SAMPLE go snippet (errcheck-invalid) for rule-engine tests.

Intentionally invalid Haskell (unterminated string) for parser failure tests.

Haskell foldl snippet for AST and highlighter tests.

Idiomatic Haskell hello-world for GHC / HLS fixtures.

Haskell Maybe pattern matching — realistic small module.

Haskell Typeclass SAMPLE for Wave G language-tooling coverage.

A minimal, valid HTML5 document — doctype, head, and a single heading — for testing HTML parsers, highlighters, and validators against the simplest well-formed page.

A realistic semantic HTML page with landmark elements (header, nav, main, article, footer), a figure with alt text and caption, and lists — for testing HTML parsers, accessibility tooling, and highlighters.

A realistic Java class with a package declaration, fields, a nested record, methods that throw exceptions, and formatted output — for testing highlighters, javac, Checkstyle, and parsers.

The classic hello-world in Java — a public class with the standard main method — for testing highlighters, javac, and Java parsers.

Intentionally lint-bait SAMPLE java snippet (empty-catch-invalid) for rule-engine tests.

Java record type hello for javac / highlighter fixtures.

Tiny SAMPLE tooling config snippet (eslint-flat-snippet) for editor/linter harnesses.

The classic hello-world in modern JavaScript — a minimal function calling console.log, for testing highlighters, Node, and JS parsers.

Intentionally corrupt JavaScript object literal — labelled invalid for error handling. Labelled intentionally invalid in title and description.

A realistic JavaScript snippet with an ES class, private #fields, arrow functions, template literals, a getter, and async/await — for testing highlighters, ESLint, Prettier, and bundlers.

Intentionally lint-bait SAMPLE javascript snippet (eqeqeq-invalid) for rule-engine tests.

Intentionally lint-bait SAMPLE javascript snippet (var-shadow-invalid) for rule-engine tests.

Tiny SAMPLE tooling config snippet (prettier-config) for editor/linter harnesses.

Tiny SAMPLE tooling config snippet (tsconfig-strict-snippet) for editor/linter harnesses.

Intentionally invalid JSON (unquoted key + trailing) for strict parser failure tests. Labelled intentionally invalid in title and description.

Intentionally invalid Julia (unclosed function) for linter error-path tests.

Julia broadcast operators (.^ .+ ) for highlighter and parser edge cases.

Julia typed Fibonacci with a for-loop — realistic snippet for language tooling.

Minimal Julia hello-world for syntax highlighters and Julia LSP smoke tests.

Julia Macro SAMPLE for Wave G language-tooling coverage.

The classic hello-world in Kotlin — a top-level main function — for testing highlighters, the Kotlin compiler, and parsers.

A realistic Kotlin snippet with data classes, an enum, a sealed result interface, extension functions, and when expressions — for testing highlighters, the Kotlin compiler, ktlint, and parsers.

Kotlin data class SAMPLE for Kotlin language-server tests.

Intentionally invalid Lua table for error handling.

Tiny Lua coroutine yield loop for language tooling.

Minimal Lua hello for embedder and syntax-highlight tests.

Lua Metatable SAMPLE for Wave G language-tooling coverage.

Lua table with method colon syntax for parsers.

Tiny multi-language SAMPLE monorepo ZIP (web/api/util/scripts) for unpack-then-lint and monorepo tooling.

Intentionally invalid Nim for nim check error paths.

Minimal Nim hello for nimlsp / highlighter tests.

Nim object type plus proc — for Nim AST tooling.

Nim recursive fib proc — realistic snippet.

Nim Template SAMPLE for Wave G language-tooling coverage.

The classic hello-world in PHP — an opening tag and echo — for testing highlighters, the PHP interpreter, and parsers.

A realistic modern-PHP snippet with strict types, a namespace, a backed enum, a final class with constructor-promoted readonly properties, and array_reduce with an arrow function — for testing highlighters, PHPStan, and parsers.

PHP 8 attributes SAMPLE for PHP tooling.

Intentionally lint-bait SAMPLE php snippet (error-suppression-invalid) for rule-engine tests.

A realistic Python snippet exercising type hints, an lru_cache-memoised recursive function, a generator, and a frozen dataclass — for testing syntax highlighters, linters (ruff/flake8), and formatters (black).

The classic hello-world in idiomatic Python 3, with a shebang, a module docstring, and the standard main guard — the minimal correct program for testing highlighters and interpreters.

Intentionally invalid Python indentation for linter / parser error-path tests. Labelled intentionally invalid in title and description.

Intentionally invalid Python match (missing colon) for linters.

Tiny asyncio gather stub for async Python tooling.

Python dataclass SAMPLE for highlighter and type-checker smoke tests.

Intentionally lint-bait SAMPLE python snippet (bare-except-invalid) for rule-engine tests.

Intentionally lint-bait SAMPLE python snippet (unused-import-invalid) for rule-engine tests.

Intentionally invalid R (unclosed call) for parser tests.

R data.frame construction — realistic snippet for R parsers.

Minimal R hello-world for RStudio / language-server fixtures.

R native pipe (|>) snippet for modern R tooling.

The classic hello-world in Ruby — a single puts — for testing highlighters, the Ruby interpreter, and parsers.

A realistic Ruby snippet: a Stack class that mixes in Enumerable, yields blocks, raises a custom error class, and uses string interpolation and symbol-to-proc — for testing highlighters, RuboCop, and parsers.

Intentionally lint-bait SAMPLE ruby snippet (rescue-all-invalid) for rule-engine tests.

Ruby nested module SAMPLE for parser tests.

The classic hello-world in Rust — fn main and the println! macro — for testing highlighters, rustc, and parsers.

Intentionally invalid Rust for rustc error-path fixtures.

A realistic Rust snippet with an enum carrying data, a trait and impl, exhaustive match, iterators, and Option handling — for testing highlighters, rustc, clippy, and parsers against real ownership-era code.

Intentionally lint-bait SAMPLE rust snippet (unwrap-invalid) for rule-engine tests.

Rust Result map chain — realistic error-handling snippet.

Scala foldLeft snippet for syntax and indexer tests.

Scala 3-style object hello for Scalac / Metals fixtures.

Scala pattern match SAMPLE for Metals fixtures.

A realistic Bash script using strict mode (set -euo pipefail), functions, default parameters, a loop, and conditionals — an illustrative fixture (review before running) for testing highlighters, ShellCheck, and shfmt.

The classic hello-world in Bash — a shebang and echo, with LF line endings so it runs on Unix — for testing highlighters, ShellCheck, and shell parsers.

Intentionally lint-bait SAMPLE shell snippet (unquoted-var-invalid) for rule-engine tests.

Bash strict-mode hello for shellcheck / highlighter tests.

The classic first query in SQL — a single SELECT of a literal — for testing highlighters, SQL parsers, and query editors.

A realistic SQL script with CREATE TABLE constraints and foreign keys, INSERT seed data, a CREATE VIEW, and a grouped aggregate query with a join — for testing SQL parsers, formatters, and highlighters.

Tiny SAMPLE SQL shape (drop-table-comment) for static-analysis demos — not live DDL.

Tiny SAMPLE SQL shape (implicit-cross-join) for static-analysis demos — not live DDL.

Tiny SAMPLE SQL shape (missing-where-update) for static-analysis demos — not live DDL.

Tiny SAMPLE SQL shape (order-by-injection-shape) for static-analysis demos — not live DDL.

Tiny SAMPLE SQL shape (select-star-invalid) for static-analysis demos — not live DDL.

Tiny SAMPLE SQL shape (union-all-dupes) for static-analysis demos — not live DDL.

SQL window function SAMPLE for SQL parsers.

The classic hello-world in Swift — a single print — for testing highlighters, the Swift compiler, and parsers.

A realistic Swift snippet with an enum, a protocol, a struct with a computed property, optionals and optional binding, and higher-order functions — for testing highlighters, the Swift compiler, SwiftLint, and parsers.

Swift struct SAMPLE for SourceKit fixtures.

The classic hello-world in TypeScript (shipped as .mts to avoid the MPEG-TS .ts collision) — a typed function for testing TypeScript-aware highlighters and the tsc compiler.

A realistic TypeScript snippet with an enum, a discriminated union, generics, exhaustive switch handling, and a typed reduce — for testing the type checker, highlighters, and the TS ESLint parser.

Intentionally lint-bait SAMPLE typescript snippet (any-cast-invalid) for rule-engine tests.

TypeScript satisfies operator sample (.mts) for TS tooling.

Tiny SAMPLE tooling config snippet (docker-compose-snippet) for editor/linter harnesses.

Tiny SAMPLE tooling config snippet (editorconfig-snippet) for editor/linter harnesses.

Tiny SAMPLE tooling config snippet (github-actions-snippet) for editor/linter harnesses.

Intentionally invalid YAML indentation for parser error fixtures. Labelled intentionally invalid in title and description.

Zig function plus a unit test stub — realistic small module.

Zig errdefer SAMPLE for Zig language-server tests.

Zig hello-world for Zig language-server and highlighter tests.
Hello-world and realistic snippets across many languages, including C#, Dart, Elixir, Zig, Scala, Julia, Haskell, Lua, R, Clojure, Fortran, and Nim — plus intentionally invalid lint fixtures clearly labelled as such.
Yes. Every text-previewable code format is editable and has an editor quick-start preset.
Wave G includes a tiny multi-language SAMPLE monorepo ZIP for unpack-then-lint pipelines.
We use Google Analytics and show ads via Adsterra. Non-essential cookies and ad scripts run only after you allow the matching categories. See our cookie policy.