Monday, September 9, 2019
Week of 9/3 - 9/10
Week of 9/2/19
Boost:
I debate going back and forth with Python C header file and the Boost.Python library. I spend time setting up a Virtual Machine in Mint to test Boost libraries without messing up my main project dependencies. These dependency issues arose when I tested boost on my main working system on Labor Day, and I was forced to revert to a previous back up state for my whole system.
Boost proves to be a fickle animal. After building with their proprietary build shell script, it doesn't call in the Virtual Machine properly, though I can get SFML and other open source additional libraries working fine.
Python.h header file:
Setting up:
Setting up Python.h proves to be similar in Visual Studio to setting up SFML, OpenGL, SDL, or Vulkan. Preferably, the libaries are included in the solution file directory, and then they're called in the properties window.
For more information on that, this Stack Overflow link describes it better than I can without snapshots of internal file systems.
Thursday 9/5:
Major progress! After much trial and error, I manage to create a simple C++ program with Python.h C library embedded that takes a simple Python string argument and prints the result. The program does not allow for white space, or multiple arguments or functions, but the proof of a Python interpreter is coming together.
The above code is the example of the working Python Simple String interpreter. It takes the user's input as a Python string and reads it. I also learned the difference between 'const char*' and 'char const*', which helped the compiler not run into the error message: "no suitable conversion std::string to const char." The difference is what is constant. In this statement, the constant is the pointer, and the character changes.
Monday 9/9:
I have decided to use the Python.h C header file, though this involves learning C to read the documentation. It is more recently supported as of Python 3.7, with dev for 3.8 and 3.9 in the works. The Python.h C header file is created by the Python development team directly, and has compatibility for C to Python and Python to C, and embedding. Using Boost proved to have more challenges on the back end set up than Python.h, but the coding seemed to be easier.
After spending time at the CCLA and talking out my needs and interpreter with Adam, I have elected to use Python.h over Boost or other third party Python libraries. While I appreciate the efforts of the open source community to make this sort of implementation easier on the coding end, for my needs:
1. It is directly supported by the Python team. This is huge as documentation is more up to date, and it is much easier to move and copy Python from existing programs on my computer than a third party source.
2. I don't need to create a scripting system that changes back-end or on run-time events, things you might see in a Game Engine for mods, or reducing compile times, or business applications that use C or C++ for heavy lifting but Python for end user data manipulation. The whole goal is to interpret user code in, and check it against expected output. I would rather spend my time learning C and the Python.h implementation documentation than work out a third party, open source library with a proprietary implementation and set up methodology.
3. Learning and picking up C is never a bad thing. An additional programming language under my belt won't hurt. C in C++, C#, and Java based jobs tends to be a useful skill to have anyway.
Next major goals:
Python Interpreter:
1. Learn C well enough to read the Python C API documentation listed here.
2. Get the interpreter able to read open spaces in arguments, and simple functions or statements (if, for, while, etc.)
User Interface:
1. Work on different screen states to transition between a main menu and the "puzzle" screen. This involves going through SFML books and documentation to build that kind of engine state machine.
2. Make a "prototype" Main Menu/Start Up Screen. Design in GIMP, the buttons and interface. I don't expect the early implementation to be pretty by any means, but I want to figure out how the menu will look.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment