feat: runtime block value

This commit is contained in:
Dan Chen
2024-03-21 17:55:02 +08:00
parent 0c34fd260f
commit 1a3e6537a4
4 changed files with 45 additions and 15 deletions

View File

@ -4,10 +4,9 @@ from runtime.ast.parser import Parser
from runtime.ast.runtime import Runtime
script = """
let hello = true
let text = audio_to_text(audio)
print(hello)
return tts(text)
let hello = add(div(1,2),2)
return hello
"""
def version():
@ -42,10 +41,7 @@ if __name__ == "__main__":
"version": version,
"print": print
})
ast = Parser().parse(script)
# 注入數據
script_output = runtime.run(Parser().parse(script), {
"audio": audio_data
})
f = open("./test_data/runtime_output.mp3", "wb")
f.write(script_output.read())
f.close()
script_output = runtime.run(ast, {})
print("script:",script_output)