I Built My Own Compiled Programming Language. Here’s What I Learned.
Описание и применение
YLang — это открытый компилируемый язык, созданный автором для изучения проектирования языков и компиляторов. Он реализован на C17, использует GCC/Clang для генерации исполняемых файлов и поддерживает расширения, такие как структуры, перечисления, многопоточность и графику. Ключевые уроки включают важность корректности, управления памятью и тестирования.
Задача
Understanding what it takes to build a real compiler and a usable programming language.
Результат
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.
Рабочий процесс
- 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.
Доказательства
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.
- Дата записи: 2026-11-02T22:13:45.494Z