Documentation
Home Playground Docs Compiler

UNEL Language Reference

The complete guide to UNEL — the Universal Natural English Language.
Every program reads like a story. No symbols, no cryptic syntax — just English.

Overview

UNEL is a programming language where syntax is English grammar. Programs are written as natural English sentences. There are no semicolons, no curly braces, and no cryptic operator symbols — only readable, grammatically correct English.

Core principle: If you can say it in English, you can code it in UNEL.

UNEL vs Traditional Code

UNEL replaces cryptic symbols with plain English. Here's the same logic in three languages:

Variables & Output

UNELPythonJavaScript
Set name to "Alice". name = "Alice" let name = "Alice";
Display "Hello " plus name. print("Hello " + name) console.log("Hello " + name);

Math & Logic

UNELPythonJavaScript
Set total to price plus tax. total = price + tax let total = price + tax;
Set area to length multiplied by width. area = length * width let area = length * width;
If age is greater than 18: if age > 18: if (age > 18) {

Loops & Functions

UNELPythonJavaScript
Repeat from 1 to 10 as i: for i in range(1, 11): for (let i = 1; i <= 10; i++) {
For each item in list: for item in list: for (let item of list) {
Define function greet that takes name: def greet(name): function greet(name) {
The difference: UNEL code reads like instructions you'd give a person. No brackets, no semicolons, no symbols — just English sentences that happen to run as code.

Your First Program

Note: My first UNEL program. Set name to "World". Display "Hello, " plus name plus "!".

Every statement ends with a period. Comments start with Note:. Run with: python3 -m unel hello.unel

Variables

Declare variables with Set ... to ... — like writing a sentence.

Set name to "Alice". Set age to 25. Set score to 98.5. Set active to true. Note: Constants cannot be changed. Constant PI is 3.14159.

Data Types

TypeExampleDescription
Integer42Whole numbers
Decimal3.14Floating-point numbers
Text"Hello"Strings (double quotes)
Booleantrue / falseLogical values
List[1, 2, 3]Ordered collection
Dictionary{"key": "value"}Key-value pairs
NothingnothingNull / empty value

Operators

All operators are written in natural English — no symbols needed.

Arithmetic

UNEL SyntaxMeaningExample
a plus bAdditionSet total to price plus tax.
a minus bSubtractionSet change to paid minus cost.
a multiplied by bMultiplicationSet area to length multiplied by width.
a divided by bDivisionSet avg to total divided by count.
a modulo bRemainderSet rem to n modulo 2.

Comparison

UNEL SyntaxMeaning
a is equal to bEquality check
a is not equal to bInequality check
a is greater than bGreater than
a is less than bLess than
a is greater than or equal to bGreater or equal
a is less than or equal to bLess or equal

Logical

UNEL SyntaxMeaning
a and bBoth must be true
a or bAt least one must be true
not aNegation

Input / Output

Note: Display output to the user. Display "Hello, World!". Display "Score: " plus score. Note: Ask for input from the user. Ask "Enter your name: " and store in name. Ask "Enter your age: " and store in age. Note: Convert text input to a number. Convert age to a number. Convert weight to a decimal.
Remember: Ask always stores text. Use Convert to change it to a number or decimal.

If / Else

If age is greater than or equal to 18: Display "You are an adult.". Else if age is greater than or equal to 13: Display "You are a teenager.". Else: Display "You are a child.". End if.

Loops

Repeat N Times

Repeat 5 times: Display "Hello!". End repeat.

Repeat From / To (Range)

Repeat from 1 to 10 as i: Display i. End repeat.

For Each (Iterate)

For each fruit in fruits: Display "I like " plus fruit. End for.

While

While count is less than 10: Set count to count plus 1. End while.

Check / When (Switch)

Check day: When "Monday": Display "Start of the week.". When "Friday": Display "Almost weekend!". Default: Display "Regular day.". End check.

Functions

Define function greet that takes name: Display "Hello, " plus name plus "!". Return "greeted". End function. Note: Call the function. Set result to greet("Alice").

Lambdas

Short, inline functions for use with map, filter, and reduce.

Set double to lambda x: x multiplied by 2. Set doubled to map(numbers, double). Note: Inline lambda with filter. Set evens to filter(numbers, lambda x: mod(x, 2) is equal to 0).

Built-in Functions (77)

Math

abs round floor ceil sqrt power mod min max sin cos tan random random_int

String

upper lower trim split join replace substring starts_with ends_with pad_left pad_right

List

length append remove sort reverse contains index_of slice map filter reduce

Type

type_of to_integer to_decimal to_text is_number is_text is_list is_empty

Lists

Create list fruits containing "apple", "banana", "cherry". Set numbers to [1, 2, 3, 4, 5]. Note: Access by index (1-based). Display fruits[1]. Note: "apple" Note: Length. Display length(fruits). Note: Add an item. Set fruits to append(fruits, "date").

Dictionaries

Create dictionary user with "name" as "Alice", "age" as 30. Display user["name"]. Display keys of user. Display has_key(user, "email").

Structs

Define shape Person with fields: name as Text default "". age as Integer default 0. End shape. Define method greet on Person: Display "Hi, I'm " plus self's name. End method. Set p to new Person with name "Alice", age 30.

Modules & Imports

Import Math. Display Math.sqrt(144). Import Convert. Display Convert.to_hex(255). Import DateTime. Display DateTime.now().

16 standard library modules: Math, String, Convert, DateTime, IO, JSON, HTTP, Regex, Log, Testing, Validate, Functional, Collections, Crypto, Env, System.

Error Handling

Try: Set result to 10 divided by 0. Catch error: Display "Error: " plus error. End try.

Concurrency

Note: Start async tasks. Start task download with url "https://api.example.com". Wait for download to finish. Note: Channel communication. Create channel results. Send 42 to results. Receive from results.