phasm/py2wasm/utils.py
2021-04-05 10:41:26 +02:00

19 lines
328 B
Python

"""
Utility functions
"""
import ast
from py2wasm.python import Visitor
def process(source: str, input_name: str) -> str:
"""
Processes the python code into web assembly code
"""
res = ast.parse(source, input_name)
visitor = Visitor()
module = visitor.visit_Module(res)
return module.generate()