📖 Read this in other languages: English | Português (Brasil)
Ever wondered how Python, JavaScript, or PHP actually work under the hood?
JECH is a programming language built from scratch to teach you exactly that — in a clear, documented, and accessible way.
You're a developer who:
- ✅ Knows Python, JavaScript, or PHP
- ✅ Writes code every day
- ✅ Wonders "how does
print()actually work?" - ❌ Has never touched C or compilers
- ❌ Doesn't know what "bytecode" means
- ❌ Thinks "lexer" sounds intimidating
Perfect! JECH was built specifically for you.
You know how to use Python:
print("Hello")
x = 10
if x > 5:
print(x)But you have no idea how Python actually executes this. It's magic! ✨
JECH shows you exactly how it works, step by step:
Your Code → Tokenizer → Parser → AST → Bytecode → VM → Output
📝 🔤 🧱 🌳 🔧 ⚡ ✨
Every stage is:
- ✅ Documented with examples
- ✅ Explained in terms you already know
- ✅ Visible - you can see it happen
- ✅ Modular - each piece is independent
git clone https://github.com/yourusername/jech
cd jech
make./build/jech>>> keep x = 10;
>>> say(x);
10
>>> keep name = "JECH";
>>> say(name);
JECH
>>> keep numbers = [1, 2, 3];
>>> say(numbers[0]);
1
It's like Python's interactive mode!
./build/jech examples/17_arrays_basic.jcYou know this:
print("Hello")JECH shows you this happens:
1. Tokenizer breaks it into: [print] [(] ["Hello"] [)]
2. Parser understands: "This is a print statement"
3. Compiler generates: OP_PRINT "Hello"
4. VM executes: Output "Hello" to screen
Same process Python uses! (CPython does exactly this)
You know this:
const x = 10;
console.log(x);JECH shows you:
- How V8 tokenizes your code
- How the parser builds an AST
- How bytecode is generated
- How the VM executes it
Same principles, different syntax!
You know this:
$x = 10;
echo $x;JECH reveals:
- How Zend Engine processes your code
- How opcodes are generated
- How the executor runs them
Same architecture!
Goal: Get comfortable with JECH syntax
# Try the REPL
./build/jech
# Run examples
./build/jech examples/01_hello_world.jc
./build/jech examples/17_arrays_basic.jcTime: 15 minutes
Docs: Language Features
Goal: Learn how languages work (no C required!)
Read: For Beginners Guide
This guide explains:
- What is a tokenizer? (with Python analogies)
- What is a parser? (with JavaScript examples)
- What is bytecode? (like Python's
.pycfiles) - What is a VM? (like CPython)
Time: 30 minutes
Prerequisites: None! Just curiosity
Goal: Watch code transform through each stage
Read: Architecture Overview
Follow a single line of code:
say("Hello");
Through all 5 stages:
- Tokenizer →
[say] [(] ["Hello"] [)] [;] - Parser →
SAY_STATEMENT - AST →
SAY_NODE { value: "Hello" } - Bytecode →
OP_SAY "Hello" - VM →
print("Hello")
Time: 45 minutes
Prerequisites: Level 2
Goal: Understand each component in detail
Read:
- Tokenizer - How code becomes tokens
- Parser - How tokens become structure
- AST - How structure becomes trees
- Bytecode - How trees become instructions
- VM - How instructions become execution
Time: 2-3 hours
Prerequisites: Level 3
Goal: Add features, fix bugs, improve docs
Read: Contributing Guide
You can contribute even without knowing C:
- Write example programs
- Improve documentation
- Report bugs
- Suggest features
- Write tests
Time: Ongoing
Prerequisites: Enthusiasm!
keep x = 10;
keep name = "João";
keep active = true;
say(x); // 10
say(name); // João
say(active); // true
Like: Python's x = 10, JavaScript's const x = 10, PHP's $x = 10
keep numbers = [1, 2, 3, 4, 5];
keep names = ["Alice", "Bob", "Charlie"];
keep mixed = [42, "text", true];
say(numbers[0]); // 1
say(names[1]); // Bob
say(mixed[2]); // true
Like: Python lists, JavaScript arrays, PHP arrays
keep age = 20;
when (age > 18) {
say("Adult");
}
else {
say("Minor");
}
Like: Python's if, JavaScript's if, PHP's if
say("Hello, World!");
say(42);
say(true);
say(myVariable);
say(myArray[0]);
Like: Python's print(), JavaScript's console.log(), PHP's echo
Every line of code goes through 5 stages:
┌─────────────┐
│ Source Code │ say("Hello");
└──────┬──────┘
│
▼
┌─────────────┐
│ Tokenizer │ [say] [(] ["Hello"] [)] [;]
└──────┬──────┘
│
▼
┌─────────────┐
│ Parser │ SAY_STATEMENT { value: "Hello" }
└──────┬──────┘
│
▼
┌─────────────┐
│ AST │ SAY_NODE → "Hello"
└──────┬──────┘
│
▼
┌─────────────┐
│ Bytecode │ [OP_SAY "Hello"]
└──────┬──────┘
│
▼
┌─────────────┐
│ VM │ Execute: print "Hello"
└──────┬──────┘
│
▼
Output: Hello
This is exactly how Python works:
| JECH Stage | Python Equivalent | What It Does |
|---|---|---|
| Tokenizer | tokenize module |
Breaks code into pieces |
| Parser | ast.parse() |
Validates syntax |
| AST | ast.AST |
Creates tree structure |
| Bytecode | .pyc files |
Compiles to instructions |
| VM | CPython | Executes instructions |
Mind blown? 🤯 Now you know how Python works!
JECH has 70 automated tests covering:
- ✅ Tokenizer (32 assertions)
- ✅ Parser (25 assertions)
- ✅ VM (6 assertions)
- ✅ Integration (7 assertions)
./run_tests.shAutomatically run tests before every commit:
./install_hooks.shLike: Python's pytest, JavaScript's jest, PHP's PHPUnit
- For Beginners Guide ⭐
- No C knowledge required
- Uses Python/JavaScript analogies
- Explains every concept simply
- Architecture Overview
- Complete pipeline explanation
- Visual diagrams
- Step-by-step examples
- Tokenizer - Lexical analysis
- Parser - Syntax analysis
- AST - Tree structures
- Bytecode - Compilation
- VM - Execution
Learn how your favorite languages work:
- Python (CPython)
- JavaScript (V8, SpiderMonkey)
- PHP (Zend Engine)
- Ruby (YARV)
All use the same principles JECH demonstrates!
Every stage is visible:
# See tokens
./build/jech --debug-tokens myfile.jc
# See AST
./build/jech --debug-ast myfile.jc
# See bytecode
./build/jech --debug-bytecode myfile.jcReal features:
- ✅ Variables
- ✅ Arrays
- ✅ Conditionals
- ✅ REPL
- ✅ Error messages
- ✅ Type system (coming soon)
Small codebase:
- ~3,000 lines of C
- Well-documented
- Modular design
- Easy to understand
JECH exists to teach how programming languages work. Every design decision prioritizes clarity over performance.
Show that building a language is achievable. You don't need a PhD or 10 years of C experience.
JECH is not meant to replace Python, JavaScript, or PHP. It's a learning tool.
JECH was created as:
- A learning journey - Understanding how languages work
- A teaching tool - Sharing that knowledge with others
- A tribute - To my sons Jonathan Edwards and Charles Haddon (J-E-C-H)
It's built with love, for learners, by a learner.
We welcome contributions from developers of all experience levels!
- 📝 Writing example programs
- 📖 Improving documentation
- 🐛 Reporting bugs
- 💡 Suggesting features
- 🧪 Writing tests
- 🌍 Translating docs
No C experience required!
See CONTRIBUTING.md for details.
- Language: C
- Lines of Code: ~3,000
- Tests: 70 (100% passing)
- Documentation: 6 detailed guides
- Examples: 22 programs
- Contributors: Growing!
- Tokenizer
- Parser
- AST
- Bytecode compiler
- Virtual Machine
- Variables
- Arrays
- Conditionals
- REPL
- Comprehensive tests
- Documentation
- Functions
- Loops
- Type system
- Standard library
- Garbage collection
- Optimization passes
- JIT compilation
- Package manager
See roadmap.md for details.
- For Beginners - Start here!
- Architecture - See the big picture
- Tokenizer - First stage
- Parser - Second stage
- VM - Final stage
- Crafting Interpreters - Excellent book
- CPython Internals - How Python works
- V8 Blog - How JavaScript works
JECH is free and open-source software licensed under the Apache 2.0 License.
- Python - For inspiration and design patterns
- Crafting Interpreters - For educational approach
- The community - For feedback and contributions
Ready to learn how languages work?
Get Started | Documentation | Contribute
Made with ❤️ for curious developers
