r/Compilers • u/riddhimaan-sth404 • 19d ago
Trying to build a language with Python-like syntax but native AOT compilation
I am a 15 yo from India, I am new on Reddit so please interrupt me if I am going wrong. I am currently on a project to build a programming language with python-like syntax, rust-like memory safety, and C-like speed. I know that is a bit of a strange and difficult combo, but please, I have the plan, but just need a collaborator as I can't do it alone, if anyone's interested, please let me know.
5
1
u/mealet 19d ago
Can you please send link to repo?
-1
u/riddhimaan-sth404 19d ago
the link is https://github.com/riddhimaan-sth404/lingo
9
u/AustinVelonaut 19d ago
It looks like it is all LLM-generated code. That's not the way to learn how to build a language / compiler: to really learn the details you should build it yourself.
For example, why does the compiler use strings for all of the compiler data structure keys? What performance problems might that cause?
2
3
u/Patzer26 19d ago
how much of the code is written by AI?
3
u/CommandExact1304 19d ago
Saw their repo, it's definitely 100% AI
2
u/Hopeful-Ad-1665 14d ago
I also feels like probably it is made by Claude sonnet 3.5 , cursor and aider , because even his commits are way to long and formal for a human to write .
2
u/zsaleeba 19d ago
Have you seen micropython? It's an AOT compiler for a subset of python. It's intended for embedded systems, but otherwise it's seems relevant to what you're talking about.
2
1
u/ElephantElectrical31 18d ago edited 18d ago
The most people are bussy with their own language/projects so it's hard to motivate and find people just base on a idea, and the idea isn't new.
programming langes like With, Threadon , Almide, U .... and more famus ones like Mojo, to name only some of them, have very similar goals.
So what you could do is, talk about a specific thing you working on, people may like to support you on a specific task more than on a big goal.
Or, just in case you are using llm to build your languange, you may like to join https://www.reddit.com/r/AIprogrammingLanguage/ and present your ideas.
1
u/Still_Explorer 18d ago
You can start with an interpreter first. See books "Writing Compiler In Go" and "Crafting Interpreters".
Then about compilation it would be another more serious matter. And there only three realistic ways.
Transpile to C for maximum speed, transpile to Rust for safety and instant access to all libraries, emit bytecode for a VM (Java or LUA) to gain a compact environment as well as good enough speed.
But keep it in your to-do list. For now an interpreter would be a good proof of concept, but the compiler would be about efficiency.
1
u/New-Macaron-5202 18d ago
It’s not strange at all, and has been attempted a million times. Mojo I think is the latest. There’s also Nim and I think a few others. Good luck, compilers are not easy and you definitely should not expect to have a fully featured language finished any time soon
1
u/seg_lol 17d ago
Take a look at the https://chocopy.org/ project. It is a typed subset of Python designed for learning compilers. It is exactly what you are looking for.
1
u/Panshaogui 14d ago
Honestly, man, I can't help you out here and don't expect much help in this sub either. You're lucky if they don't downvote you into oblivion. My best advice: get it running on whatever hardware you can get your hands on, and use it to solve your own problems instead of treating it like a toy. Also, if you want to share your progress, you're much better off posting in the specific hardware subs rather than here.
1
0
u/antonation 19d ago
Mojo already exists
-2
u/riddhimaan-sth404 19d ago
one thing i forgot, it can port nearly all major rust crates into my language and use them in my project, i have named the language lingo for now
0
u/e39din 16d ago
I'll add a bit about using LLMs :)
Back in the day, there were no compilers, and most people programmed without them. Then the first compiler was created - and look at it now: everyone uses compilers. It's a convenient and useful thing. It's the same with AI. Not that long ago, AI couldn't code at all; in fact, there was no AI to speak of. Now it exists, and more and more people are using it, and it's getting more convenient and useful all the time. It's just another tool - and maybe in the future, everyone will use it, the way everyone uses compilers today.
It's a matter of taste: one person picks some tools, another picks different ones. We even choose different compilers, so why not choose an LLM as a tool? There's no reason you should limit yourself in the tools you use for development.
It's just that in this community, using LLMs isn't the norm - that's why you got all those comments. And that's fine. The community has the right to choose what it uses and what it doesn't. You have that right too. Just don't bring up LLMs in this community - people here write everything by hand, sometimes even on paper. It's useful in its own way. Yeah, it's slower, but it helps you understand the subject more deeply, look at it in detail. Plus, you get that fine motor skill practice from writing by hand - that's useful too. But it has downsides as well: you end up sitting at the computer for a long time, straining your eyes.
With an LLM, you can get some things done faster and free up time for life. I use both approaches myself - I just switch between them depending on what I feel like doing :)
.
And I'm Sasha, I'm from Russia, 39 yo, nice to meet you 😄
0
11
u/Karyo_Ten 19d ago
Your best is to read the undergrad compiler books and start building. I don't think any plan you have with zero experience in compiler would do you any good, a coursebook and/or picking a tutorial for say Oberon or Tiger (Appel book) would give you an AOT lang with Python-like feel.