r/C_Programming • • 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:

  1. Lexer & Parser (lexer.c, parser.c): A hand-written lexer and recursive descent parser parsing tokens, expressions, and block scopes without external parser generators.
  2. Typechecker (typechecker.c): Handles semantic analysis, symbol resolution, and type checking across AST nodes.
  3. Memory Management (arena.c): Implements custom arena allocators to manage AST node lifetimes efficiently during compilation passes.
  4. 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!

0 Upvotes

8 comments sorted by

•

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/Able_Bee4420 Oct 24 '26

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 Oct 24 '26

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

0

u/AsterrZep Oct 24 '26

Hey, thanks for the feedback regarding the issues Astra has. Honestly, the language used for the bootstrap seed or the compiler doesn't matter to me; in the end, all I want is for Astra to work and fulfill the purpose it was designed for. I'm not sure why the passive-aggressive attitude, but thanks anyway. Ultimately, this is exactly why I wanted to share Astra in the first place.

So that people like YOU could give their feedback, even though you didn't take the time or the few minutes to review it manually and asked an AI to do it instead (ironic, I suppose). I hope that in the future Astra will be to your liking and that you can help and collaborate.

1

u/bzbub2 Oct 24 '26

i apologize for the nasty tone. i just think people need to own up. you claim to have done a lot of things yourself. honestly, prove it. everything in the repo screams completely vibe coded. and fwiw, I am very ai pilled, but also, worry about what it means for learners.

i learned C by reading K&R C back in the day.

toiling through that probably seems like tinkertoys.

vibe coding catapults the entire discussion window way beyond that. as i said, you drew the rest of the owl already. you dont truly need any feedback on the c code itself really. you have bigger cans of worms now. and unfortunately, i think by trying to take the 'no holds barred' multi-pronged attack of so many things in your language, you have lost sight a little bit what you are capable of delivering. i have seen same thing in my own projects, and you have to dial it back...bulk and cut...or go back to the drawing board, start from scratch.

0

u/Able_Bee4420 Oct 24 '26

En realidad tienes toda la razón, tal vez perdí el sentido del lenguaje, pero para eso lo publico y pruebo, para aprender, aprender del mundo de bajo nivel, probablemente mucho de lo que promete el lenguaje no funcione por no ser compatibles, pero oye, todo lo que aprenda con este proyecto lo utilizare, muy probablemente para crear proyectos muchos mejores, evidentemente soy mucho más joven e ingenuo qué tu, y yo aprecio que me den consejos. 

Abrazo 

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

  • ❌ Low Star Count (⭐ 2 / 4 required)
  • ✅ Mature Repository (30+ days old)
  • ✅ Licensed under MIT
  • ❌ No Security Policy
  • ℹ️ Personal Account Repository
  • ℹ️ Unsigned Commits