Language Syntax
Dryft is a concatenative, stack-based programming language with a simple and elegant syntax. Programs flow naturally from left to right, with data transformations composed in a readable sequence.Why Concatenative?
Programming is fundamentally about designing systems with data flowing in complex ways. Dryft’s concatenative style excels at this by making data flow explicit and readable.Comparison with Traditional Languages
Consider transforming a potato through multiple steps: Traditional nested functions (hard to read):Basic Syntax Elements
Tokens and Whitespace
Dryft code is tokenized by whitespace (spaces, tabs, newlines). Each token represents a value, operation, or keyword:Comments
Comments are delimited by# on both sides:
String Literals
Strings are enclosed in double quotes:Numeric Literals
Integer literals can be positive or negative:Boolean Literals
Boolean values usetrue and false:
Block Delimiters
Dryft uses consistent syntax for defining blocks:- Start delimiter: keyword or
keyword: - End delimiter:
:keywordor;
Examples
No Operator Precedence
Dryft eliminates the need for parentheses and operator precedence rules. Everything is evaluated left-to-right:Stack-Based Evaluation
Values are pushed onto a stack, and operations consume values from the stack:Stack Manipulation
Annotations
Type annotations provide documentation and are enclosed in parentheses:(inputs -> outputs)
File Inclusion
Include other Dryft files with theinclude keyword:
.dry extension is automatically appended.