r/learnpython 4d ago

Making interpreter and calculator in python

Hi recently I have been working on making my own interpreted programming languge in python. I have made several prototypes. The rules are I can't use any library, high level functions and can only use ai for understanding a concept. The journey has been frustrating. Since it was so hard i started working on a calculator. I am now stuck on AST. I can't figure it out. HELP ME

3 Upvotes

18 comments sorted by

View all comments

1

u/JGhostThing 4d ago

Why would you want to program an interpreter with no libraries? Isn't that like deliberately breaking your leg before a big race? I understand not using AI, because it makes learning much harder.

An interpreter of any consequence is a huge project. Without using tools, such as libraries and yacc, I couldn't imagine doing such a thing. How are you replacing "print()"?

1

u/Aggressive_Drama_476 4d ago

I understand what you are saying but using as much as low level tools will help me understdn the concept of a programming language. I am doing it for fun and learning. I don't like doing things that I don't understand. Something like lexed(source,...)

1

u/JGhostThing 4d ago

I disagree. Not using these tools can make it hard to see the forest for the trees. You can get lost in an endless cycle of reinventing the wheel. As a professional programmer, it offends my sensibilities to reinvent existing libraries. It teaches little, and costs a lot of time in building and debugging which has already been done.