Hey everyone! I'm a Python app developer who's been trying my hand at creating a programming language using C. I've gotten the basics down—like print statements, basic math functions, and variables. Now, I'm looking to add support for libraries so I can create standalone libraries and incorporate their functions into my project. What would be the best way to go about this? Any suggestions would be greatly appreciated!
1 Answer
Sounds like you’re off to a great start! Adding library support isn’t too complicated. You can create each library as a separate file using your own language’s syntax. Then, introduce an "import" command that reads the library file and integrates its functions into your main program. Start simple—maybe just copy the library code directly into your program at runtime. Managing the file paths can be a hassle, so I suggest keeping all your libraries in one folder for easy access. Just be careful with variable scopes to avoid conflicts between library variables and your main program.
Thanks a lot! I’ll definitely take your advice!