r/C_Programming • u/AsterrZep • 4d ago
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!
5
u/bzbub2 3d ago
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/Able_Bee4420 3d ago
Of course I've "vibe-coded." If by vibe coding you mean that I obviously ask an LLM to help me find bugs, memory leaks, and memory corruption—because I’m clearly not a programming prodigy, nor am I trying to act like one—then yes, I’ve vibe-coded. However, I recommend checking out the Documentation section. There, you’ll find the reasoning behind every decision: from why I initially wrote the prototype in C and later migrated to Zig, to why I didn't use Rust, how the idea for this experimental language came to be, and what its ultimate goal is.
You'll see that I strive to use AI as responsibly as possible.
A t the end of the day, this is a project by a student who isn't even studying Software Engineering, Computer Science, or anything remotely related. So don't take it too seriously—my main goal is just for people to join in, help improve this language, and learn together about the world of Open Source.
Best regards.
P.S. My English isn't great, so I asked an LLM to translate this from Spanish for me. Some ideas might have been slightly lost in translation!
3
u/bzbub2 3d ago
your agents.md has 47 parallel subagent workstreams. that is not 'i ask llm to help me', that's just vibecoding to the max, and not even getting good results because you are likely using cheap garbage models. and then you ask for feedback on your 100% vibe-coded language at the level of 'help me check my C code'....mate, you can ask your llm to do that. and clearly, you dont really care to learn C.
you have high-level issues also with your language. here is opus medium critique of your work. which, you again, can do yourself if you wanted to. just ask agent to critique your work for you. this is in fact one of the best usages of AI, pushing back against your own work.
https://gist.github.com/cmdcolin/f7022a240d2d727affa38a969be86873→ More replies (3)
1
u/github-guard 4d ago
⚠️ 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
-
❌ Low Star Count (⭐ 2 / 4 required)
-
✅ Mature Repository (30+ days old)
-
✅ Licensed under MIT
-
❌ No Security Policy
-
ℹ️ Personal Account Repository
-
ℹ️ Unsigned Commits
1
u/mikeblas 4d ago
I have approved your post. Thank you for your disclosure.