Is the goal here to keep the code as a python dialect, with the C++ translation as a build step, or would the C++ eventually become main source?
Great question! The plan is to keep it in Python for the forseeable future, and avoiding writing C++ by hand as much as possible.
There’s less than 2K lines of hand-written C++ code now. I expect 90-98% of it to be generated.
Here almost every file under over 100 lines is hand-written, and almost every file over 100 lines is generated (except mylib.cc, etc.) The parser is 10 or more Python files translated into osh_parse.cc.
I have some ideas to move it off of Python by bootstrapping, but it’s very speculative and won’t happen for years if ever.
Python is nice because you can test out changes really quickly. You can just edit the code and run bin/osh in milliseconds, which is invaluable for development. I really dislike waiting for compilers! The MyPy type checking is also a bit slow, but it’s not in the edit-run cycle. It’s sort of an “offline” build step after the code is correct.