Getting Started with Layman
Learn how to write programs in pure, natural English
What is Layman?
Layman is a programming language designed to bridge the gap between natural human communication and deterministic computation. Programs are written in pure English prose that reads like documentation, yet compile to efficient, deterministic code.
Key Features:
- Pure English syntax - no special characters
- Reads like natural prose
- Deterministic parsing - same text, same AST, every time
- Type-safe with inference
- Production-ready and performant
Installation
Layman is written in Rust. To build from source, you'll need Rust installed.
# Clone the repository
git clone https://github.com/layman-lang/layman.git
cd layman
# Build the compiler
cargo build --release
# The binary will be at target/release/laymanOr use the Makefile: make build-release
Your First Program
Create a file called hello.lay:
print 'Hello, World!'
name is 'Layman'
greeting is 'Hello, ' plus name
print greetingNotice how this reads like natural English? That's the power of Layman.
Running Your Program
You can compile and run in one step, or compile first then run:
# Compile and run in one step
cargo run -- hello.lay
# Or compile first, then run
cargo run -- compile hello.lay
./helloCore Concepts
Variables
Declare variables with natural English
# Type inference - Layman knows this is a String
name is 'Alice'
# Explicit type annotation
age of type Number is 25
# Multi-word variable names are allowed
user name is 'Bob'
total count is 100Functions
Define functions that read like sentences
define function greet that takes name as String and returns Void
greeting is 'Hello, ' plus name
print greeting
# Call the function
call function greet with argument 'World'Control Flow
Make decisions and loop naturally
temperature is 75
if temperature is greater than 70 then
print "it is warm outside"
else
print "it is cool outside"
end if
# Loop through a list
numbers is a list containing 1, 2, 3, 4, 5
for each num in numbers do
print num
end for