It is a little rough around the edges but it is basically what I wanted in bridging the gap in between languages. I tweaked it slightly to fit my needs, although not completely functional in the way I want yet, it is in some state usable. Great, right? Well, not quite, because I haven't quite been able to figure out how to make RenPy itself parse this parser. I attempted importing the relevant code and declaring the import as python code beforehand, but it gives me this error:
Code: Select all
Traceback (most recent call last):
File "renpy/common/00console.rpy", line 689, in run
renpy.python.py_exec(code)
File "renpy/python.py", line 2258, in py_exec
exec(py_compile(source, 'exec'), store, locals)
File "<none>", line 1, in <module>
File "renpy/loader.py", line 985, in load_module
exec(code, mod.__dict__)
File "forthmain.py", line 1, in <module>
File "renpy/loader.py", line 985, in load_module
exec(code, mod.__dict__)
File "lexer.py", line 2, in <module>
ImportError: cannot import name ForthException
Code: Select all
class ForthException(Exception):
def forth__init__(self, msg):
self.msg = msg
def forth__str__(self):
return self.msg
Yes, I'm aware it would be faster and easier to learn Python and the scripting of RenPy, and write my code in that. I suspect however if I'm not doing this in a way I enjoy, then it won't be enjoyed. And having to learn a new language entirely would curbstomp my enjoyment.