r/C_Programming • u/AsterrZep • Oct 23 '26
Writing a seed compiler for an experimental programming language from scratch in C (Astra) – Student Project
Hi everyone,
I'm a student currently exploring systems programming and compiler design. I wanted to share a project I've been developing called Astra (AsterrZep/Astra). Specifically, I'm sharing the seed compiler written completely in C (seed/src/), built to learn about custom memory management, parsing, and compilation pipelines from the ground up.
As I'm still learning, there might be room for improvement in my C code. I would really appreciate any constructive feedback, code reviews, or advice on best practices!
⚙️ Architecture & C Implementation The compiler pipeline inside seed/src/ is modularly structured around traditional systems programming patterns:
- Lexer & Parser (lexer.c, parser.c): A hand-written lexer and recursive descent parser parsing tokens, expressions, and block scopes without external parser generators.
- Typechecker (typechecker.c): Handles semantic analysis, symbol resolution, and type checking across AST nodes.
- Memory Management (arena.c): Implements custom arena allocators to manage AST node lifetimes efficiently during compilation passes.
- Code Generation (codegen.c, emitter.c): Emits bytecode or structured C code as output targets.
🤖 AI Disclosure (Per Subreddit Rules) As per the community guidelines regarding AI: I used AI tools (like terminal assistants) interactively as a coding co-pilot and rubber duck to help scaffold repetitive C boilerplate (such as mapping standard AST construct handlers in seed/src/constructs/). However, the core compiler architecture, memory models, debugging, parser logic, and integration were entirely human-driven and manually refined.
🔗 Repository & Code If you want to review the source code, check out the C implementation details, or look at the test suites (seed/tests/conformance/):
GitHub Repository: https://github.com/AsterrZep/Astra
Please feel free to point out any mistakes or areas where the C code could be cleaner or safer. Thanks for reading!
•
u/mikeblas Oct 23 '26
I have approved your post. Thank you for your disclosure.
5
u/bzbub2 Oct 24 '26
its clear you're vibe coding this more than your 'disclosure' says. I only say this because, when you are vibing that hard, it is not clear that anyone can "point out mistakes or areas where the c code could be clearner or safer". you just arent coding at a level that makes sense to do that. you have already drawn the rest of the fucking owl so to say
1
u/github-guard Oct 23 '26
⚠️ GitHub Guard: Trust Warning
One or more repositories scored below the threshold (3), but the post was not removed.
Repository: AsterrZep/Astra
Score: 2/6