kadence-lang
v0.2.4
Published
A human-readable programming language that feels like poetry
Downloads
530
Maintainers
Readme
Kadence Programming Language 🚀
A human-readable programming language that feels like poetry.
Kadence is designed to make code read like natural English while maintaining the full power of modern programming environments. It bridges the gap between readable intent and high-performance execution by compiling into clean, optimized ES6+ JavaScript.
🌟 Why Kadence?
- Poetic Syntax: Express logic in sentences, not just symbols.
- Zero Punctuation Fatigue: Minimal requirement for braces, semicolons, or boilerplate.
- Modern Power: Built-in support for Classes, Async/Await, Pattern Matching, and Functional Programming.
- Universal: Run in Node.js for CLI tools or in any modern browser for web apps.
- Smart DX: Intelligent preprocessor for indentation-based blocks with optional
endkeywords.
🚀 Quick Start
Try it now (No Install)
Use npx to initialize a new Kadence project instantly:
# For a Web Application (Vite-powered)
npx kadence-lang create my-poetic-app --web
# For a CLI/Node Application
npx kadence-lang create my-poetic-toolManual Installation
Install the CLI globally for the best experience:
npm install -g kadence-lang📝 The Kadence Experience
Create a file named intro.kade:
let name be "Kadence"
say "Welcome to {name}!"
let numbers be list 1 2 3 4 5
let avg = average of numbers
if avg more than 3
say "Success: The average is high! ({avg})"
else
say "The average is {avg}"
end
// Functional power
let doubled = map numbers with (x) => x * 2
say "Doubled: {doubled}"Run it immediately:
kadence intro.kadeValidate your install with the bundled example:
kadence examples/01_hello_world.kade🏗️ Language Features
Variables & Blocks
Kadence uses let, const, be, and is for natural declarations.
let mutable be 42
const fixed is "eternal"
// Blocks can be indentation-based or explicit
if status equals "ok"
say "Proceeding..."
endPattern Matching
Modern branching logic that reads like a story.
match status_code
when 200 then say "Success"
when 404 then say "Not Found"
else say "Unknown Error"
endAsync/Await
First-class support for the modern web and I/O.
async function fetchUser id
say "Fetching user {id}..."
let data = await get from "https://api.example.com/users/{id}"
give data
endClasses
Clean, readable Object-Oriented programming.
class Manager
function constructor name
this.name = name
end
function greet
say "Manager {this.name} reports for duty!"
end
end
let boss = new Manager "Alice"
run boss.greet📦 Standard Library
Kadence ships with a comprehensive set of modules for common tasks.
| Module | Core Functionality |
| :--- | :--- |
| array | flatten, zip, chunk, partition, take, drop, reverse, findIndex |
| async | delay, timeout, retry, debounce, throttle, parallel, sequential, waterfall |
| list | first, lastOf, shuffle, makeRange, unique, sort, sortBy |
| string | trimmed, repeated, toCamelCase, padStart, words, lines, capitalized |
| map | keys, values, entries, merge, pick, omit, mapValues, deepClone, fromPairs |
| set | union, intersection, difference, isSubset, isSuperset, cartesianProduct |
| format | currency, fileSize, ordinal, plural, titleCase, snakeCase, kebabCase |
| validation | isEmail, isUrl, isNumeric, isAlpha, isInRange, isHexColor, isCreditCard |
| math | clamp, randomFloat, hypotenuse, areaOfCircle, isEven, toRadians |
| datetime | currentTime, today, year, month, day, toIso, addDays |
| file | readFile, writeFile, copyDir, removeDir, stat, listDir, exists |
| path | joinPaths, resolve, basename, dirname, extension |
| env | getEnv, hasEnv |
| process | args, exit, cwd |
| system | platform, arch, totalMemory, freeMemory, cpus, homedir |
| network | serve, fetchJson |
| json | readJson, writeJson, format, parseSafe |
| check | isNumber, isString, isEmail, between, coalesce |
| test | suite, assertEquals, assertTrue, assertThrows |
| color | rgb, rgba, hex, randomHex |
| html | tag, div, span, p, img, link, h1 |
| crypto | hash, randomBytes |
| uuid | v4, validate |
| random | float, integer, choice, shuffle |
| stream | createReader, readAll, pipe |
| url | parseUrl, buildUrl, getSearchParam |
Usage Example:
import "stdlib/math.kade" as math
let result = run math.clamp index 0 100🛠️ Tooling
VS Code Extension
The official extension provides:
- ✨ Syntax Highlighting
- ⌨️ Intelligent Snippets (
if,for,function,class,match) - 📏 Auto-Indentation
To install: Copy the kadence-vscode folder to your .vscode/extensions directory or search for "Kadence" in the marketplace.
CLI Commands
kadence <file> # Run a file
kadence -c <file> # Compile to JS
kadence build # Build project (src -> dist)
kadence dev # Start dev server (for --web projects)
kadence help # View all commands🗺️ Roadmap
- [x] Full Module System (
import/export) - [x] Standard Library Core (32 modules)
- [x] Browser Runtime & Vite Plugin
- [x] Source Maps for easy debugging
- [ ] Language Server Protocol (LSP) for enhanced IDE support
- [ ] Integrated Package Registry for Kadence modules
- [ ] Native Mobile Build Target
🤝 Contributing
We love poetic code. If you want to contribute, please check our Contributing Guide.
📄 License
Kadence is released under the MIT License.
Made with ❤️ for developers who believe code should be beautiful.
