I Built My Own Compiled Programming Language. Here’s What I Learned.
Description and use
YLang is an open‑source compiled language built to explore language design and compiler construction. Implemented in C17 and targeting GCC/Clang, it offers features like structs, enums, multi‑file support, SDL2 GUI, HTTP, and experimental ownership. Lessons learned emphasize correctness, memory safety, testing, architecture, and documentation.
Problem
Understanding what it takes to build a real compiler and a usable programming language.
Outcome
YLang demonstrates that building a compiler is more complex than syntax design; key lessons include the importance of correctness, memory safety, testing, architecture, and documentation.
Workflow
- Define language goals (readable syntax, static typing, native output, diagnostics, desktop foundation).
- Design lexer, parser, AST, semantic analysis, C codegen, and native backend pipeline.
- Implement compiler in C17 following pipeline: source → lexer → parser → AST → semantic analysis → C codegen → GCC/Clang → executable.
- Add features (structs, enums, multiple files, NASM backend, SDL2 GUI, HTTP, debugging).
- Address memory ownership with experimental owned/borrowed types.
- Plan 3.0 architecture: introduce typed IR, separate backends, add optimizations and verification.
- Iterate and document limitations.
- Release stable 2.2.0 and continue development on 3.0 branch.
Evidence
YLang's compiler is written in C17.
Its established compilation pipeline looks like this: YLang source (.yl) | v Lexer | v Parser | v AST | v Semantic Analysis | v C Codegen | v GCC / Clang | v Native executable
YLang 2.2.0 is the latest stable release.
- Record date: 2026-11-02T22:13:45.494Z