Datasets:
Download runtime/runtime.py from SNAPKITTYWEST/mantra: direct link, hf CLI and curl.
- Browser
- Download file 370 Bytes
-
https://huggingface.co/datasets/SNAPKITTYWEST/mantra/resolve/main/runtime/runtime.py
- Command line
-
hf download hf://datasets/SNAPKITTYWEST/mantra/runtime/runtime.py
-
curl -L -o runtime.py https://huggingface.co/datasets/SNAPKITTYWEST/mantra/resolve/main/runtime/runtime.py
370 Bytes
| # runtime/runtime.py — thin shell around evaluator, used by CLI | |
| from parser.parser import parse | |
| from runtime.evaluator import Evaluator | |
| def run_source(code: str): | |
| prog = parse(code) | |
| ev = Evaluator() | |
| return ev.eval_program(prog) | |
| def run_file(path: str): | |
| with open(path, 'r', encoding='utf-8') as f: | |
| code = f.read() | |
| return run_source(code) | |