The Boryn Guidebook
A beginner-friendly programming language designed for simplicity
By Musab Bin Majid
1. Introduction
Boryn is a small programming language. The idea was to make a programming language that was very similar to English so anybody can code on it. Moreover, it was also a challenge for me: "Can you make your own programming language?"
This guide explains how Boryn was built, step by step, in simple terms.
2. Language Design
The goal was to design a language that feels conversational but still practical. Boryn's main keywords are:
- say — output text or values.
- let — create variables (types are detected automatically).
- provide — read input from the user.
- when / not / end — conditional branching.
- till / end — loops (planned feature).
- build — functions (future feature).
Syntax Rules
- Strings: Always use double quotes "" for strings.
- Conditionals: Every when block must be closed with end.
- Optional else: Use not: for else conditions (optional).
- Indentation: Use indentation for code blocks inside conditionals.
Example Program
say "Hello World"
let name = "Alice"
say "Hello " + name
let marks = 59
when marks > 60:
say "You Passed"
not:
say "You Failed"
end
3. How Languages Work
Every programming language has three main stages:
Lexing
The lexer scans text and breaks it into tokens, like words in a sentence. For example:
say "Hello"
becomes tokens: SAY, STRING("Hello").
Parsing
The parser takes tokens and builds a structure (like a tree). Example:
say "Hello" becomes a PrintStatement("Hello").
Interpreting
The interpreter executes the parsed structure:
PrintStatement("Hello") prints Hello.
4. Project Structure
The project was written in C++17 with these files:
- main.cpp — entry point.
- lexer.cpp/.hpp — turns text into tokens.
- parser.cpp/.hpp — builds structures.
- Makefile — automates compilation.
- program.byn — Boryn source files.
5. Compilation and Running
Makefile
The project uses a Makefile:
CXX = g++
CXXFLAGS = -std=c++17 -Iinclude -Wall -Wextra
SRC = src/main.cpp src/lexer.cpp src/parser.cpp
OUT = boryn
all: $(OUT)
$(OUT): $(SRC)
$(CXX) $(CXXFLAGS) -o $(OUT) $(SRC)
clean:
rm -f $(OUT)
Running Code
Compile with:
make
./boryn
6. Example Session
$ ./boryn main.byn
Hello World
Hello Alice
You Failed
7. Lessons Learned
- A language is just text → tokens → structure → execution.
- Keywords shape its personality.
- Even a small project can teach the fundamentals of compilers.
8. Next Steps
Planned features for Boryn:
- Unary operations.
- ASCII Support.
- String concatenation with variables.
- Loops (aslong).
- Functions (build).
- Better error messages.
9. Inputs
⚠️ Note: Inputs do not work on the website however they work when run locally. This is the issue I am currently working on.
say "Hello World"
let name = provide "What is your name?"
say "Hello " + name
let marks = provide "Enter your marks: "
when marks > 60:
say "You Passed"
not:
say "You Failed"
end