Skip to content

Marimo

marimo

interp(module: builtin.ModuleOp) -> str

Source code in xdsl/frontend/listlang/marimo.py
13
14
15
16
17
18
19
20
21
22
23
24
25
def interp(module: builtin.ModuleOp) -> str:
    _io = StringIO()

    _i = Interpreter(module=module, file=_io)
    _i.register_implementations(ArithFunctions())
    _i.register_implementations(ScfFunctions())
    _i.register_implementations(PrintfFunctions())
    _i.register_implementations(TensorFunctions())
    _i.run_ssacfg_region(module.body, ())

    # Lowercase to avoid capitals in `True` and `False` printing of bools.
    # Safe since we never print strings other than `True` and `False`.
    return _io.getvalue().lower()

rust_md(code: str) -> mo.Html

Source code in xdsl/frontend/listlang/marimo.py
28
29
def rust_md(code: str) -> mo.Html:
    return mo.md("`" * 3 + "rust\n" + code + "\n" + "`" * 3)