我正在用 Python 制作一种编程语言。我希望能够通过键入以下内容来运行函数:
task $function:
log "Hey!"
然后您可以通过键入以下内容来调用它:
$function
现在,我有这个代码:
def runFunction(self, f):
## Here's where I need help. How will you make a function that runs a function that doesn't exist in
## the code?
...
elif i == 'task':
self.string = line[5:]
self.output = self.string.replace('{', '')
self.function = self.output.replace('}', '')
...
elif i not in self.keywords and '$' in i:
if i == self.function:
self.runFunction(self.function)
我应该怎么做才能实现runFunction()功能?