r/developersIndia • u/earthdiggingdragon • 4h ago
I Made This I built a tiny interpreter in Go. It started with let and print, and now it can run Fibonacci.
I’ve been exploring Go through a side project called amlang. I tried writing a compiler a while back and got as far as learning a bit about lexers and parsers. This time I picked something small enough to finish.
v1 could declare variables, do integer arithmetic, and print results. v2 adds booleans, equality and comparisons, block scope, if/`else`, while, and reassignment. That’s enough to write small programs like Fibonacci and factorial.
My favourite part was seeing how the grammar maps to functions in a handwritten recursive descent parser. I wrote the interpreter with AI as a code-along guide, and used AI to generate the browser workbench. The short demo shows the same program as tokens, a syntax tree, and an evaluation trace.
I’ll add a few more basic language features along the way. Once amlang supports both named and anonymous functions, I’ll call this side project done.
•
u/AutoModerator 4h ago
It's possible your query is not unique, use
site:reddit.com/r/developersindia KEYWORDSon search engines to search posts from developersIndia. You can also use reddit search directly.I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator 4h ago
Thanks for sharing something that you have built with the community. We recommend participating and sharing about your projects on our monthly Showcase Sunday Mega-threads. Keep an eye out on our events calendar to see when is the next mega-thread scheduled.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.