Language Overview
Draft is a statically-typed, compiled programming language designed for simplicity and performance. Its word-oriented syntax makes code readable and approachable while maintaining the power needed for systems programming.
Design Goals
Section titled “Design Goals”| Goal | Description |
|---|---|
| Simplicity | Minimal syntax rules. Easy to learn in hours. |
| Performance | Compiles to native code. Zero-cost abstractions. |
| Safety | No null pointer exceptions. Explicit error handling. |
| Portability | Target native, WASM, web, embedded from one codebase. |
| Productivity | Great tooling, fast compile times, clear errors. |
Language Characteristics
Section titled “Language Characteristics”Word-Oriented Syntax
Section titled “Word-Oriented Syntax”Draft uses English words for control flow instead of symbols:
if @score > 90 write("Excellent!")else if @score > 70 write("Good!")else write("Keep trying!")fin if.Variable Prefix
Section titled “Variable Prefix”All variables use the @ prefix:
@name = "Draft"@version = 1@is_awesome = trueMember Access
Section titled “Member Access”Use # for member/property access:
@length = @string#length@first = @list#first@body = @request#bodyExplicit Block Terminators
Section titled “Explicit Block Terminators”Every block has a clear ending marker:
action greet(@name) write("Hello, " + @name)fin action.
if @ready launch!fin if.
for @item in @items process(@item)fin for.No Garbage Collection
Section titled “No Garbage Collection”Draft uses ownership and manual memory management. Memory is predictable and real-time safe.
Compilation Targets
Section titled “Compilation Targets”Draft compiles to multiple backends:
| Target | Use Case |
|---|---|
| Native | Desktop apps, servers, CLI tools |
| WebAssembly | Browser apps, plugins, edge computing |
| Web | Full-stack web applications |
| Embedded | Microcontrollers, IoT devices |
| Mobile | iOS and Android apps |
Standard Library
Section titled “Standard Library”Draft ships with a rich standard library:
| Module | Purpose |
|---|---|
io |
Input/output operations |
fs |
File system access |
math |
Mathematical functions |
strings |
String manipulation |
collections |
Arrays, maps, sets |
json |
JSON encoding/decoding |
http |
HTTP client and server |
time |
Date and time handling |
process |
Process management |
Next Steps
Section titled “Next Steps”Continue to the Syntax Reference to learn Draft’s complete syntax.
