EasyLang — Language Overview¶
This overview teaches you the core ideas behind EasyLang — its syntax, structure, and how programs work.
EasyLang is designed around natural English keywords, making it beginner-friendly and easy to read.
Core Principles¶
Readable¶
Programs look like plain English.
Beginner-friendly¶
No symbols-based cryptic syntax.
Python-powered¶
You can import Python libraries directly.
Safe¶
Friendly runtime errors with helpful messages.
Flexible¶
Supports lists, dictionaries, functions, loops, modules, and more.
A Simple Example¶
we let name = "GreenBugX"
if name equals "GreenBugX" then [
so print "Hello creator!"
]
Everything reads like English!
Variables¶
Variables are created using the we let keyword:
we let x = 10
we let greeting = "Hello, World!"
Supported types include:
- Numbers (e.g., 10, 3.14)
- Strings (e.g., "Hello")
- Lists (e.g., [1, 2, 3])
- Dictionaries (e.g., {"key": "value"})
- Booleans (true, false)
Printing Output¶
Output is printed using the so print command:
so print "Hello, EasyLang!"
so print x
Conditions¶
EasyLang uses if, then, else for conditional statements:
if x greater 10 then [
so print "Big"
] else [
so print "Small"
]
Comparison operators include:
- equals
- not equals
- greater
- less
- <=
- >=
- <
- >
Loops¶
EasyLang supports repeat-while which is while loop and repeat-from which is for loop.
Repeat-While Loop¶
repeat while x less 10: do [
so print x
we let x = x plus 1
]
Repeat-From Loop¶
repeat from i = 1 to 5: do [
so print i
]
Functions¶
Functions are defined using the define keyword:
define add(a, b): do [
return a plus b
]
so print add(10, 20)
Lists & Dictionaries¶
EasyLang supports lists and dictionaries natively.
Lists¶
we let nums = [1, 2, 3]
nums.push(4)
Dictionaries¶
we let user = {
"name": "GreenBugX",
"age": 16
}
so print user.name
Modules¶
Import and use modules with the bring keyword:
Import EasyLang module:
bring "math.elangh" as math
so print math.sqrt(25)
Import Python module:
bring math as m
so print m.sin(1.57)
(Module loading behavior is implemented inside Interpreter.load_module() and _wrap_python_module() in easy_lang.py.)
Built-in Standard Library¶
EasyLang comes with a built-in standard library for common tasks, including:
- Math:
sin,cos,sqrt,pow,floor,ceil,random,randint, etc. - String Utils:
upper,lower,strip,substring,contails, etc. - List Utils:
join,lenetc. - Conversion:
int,float,str - Ranges:
range(start, end)
Full Details are in: Standard Library
File I/O¶
EasyLang supports file reading and writing:
open "data.txt" as f for write
writeline f with "Hello!"
close f
Error System¶
EasyLang has a beautiful error displayed powered by:
preety_error()- Accurate error line & column tracking
- Code snippet previews
Errors look like:
SyntaxError: Expected '=' (got '==')
1| we let x == 10
^
Summary¶
You know the basics of EasyLang now:
- English-like syntax
- Variables, Conditions, Loops, Functions
- Lists & Dictionaries
- Modules & Python integration
- Built-in Standard Library
Next Steps¶
Dive deeper into Syntax & Reference to learn the full language rules.