Somewhat working launcher with prelude!

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-21 18:58:33 -06:00
commit d02f53dc52
11 changed files with 284 additions and 41 deletions

View file

@ -2,8 +2,7 @@
Pytest fixtures.
"""
from lilith.parser import Block, parser_with_transformer, GRAMMAR
from lilith.parser import Block, GRAMMAR, parser_with_transformer
import pytest

View file

@ -2,13 +2,17 @@
"""
from lilith.interpreter import Bindings, Runtime, eval
from lilith.interpreter import Bindings, eval, Runtime
from lilith.parser import Apply, Args, Symbol
from lilith.reader import Module
from lilith.parser import Args, Apply, Symbol
import pytest
@pytest.fixture
def runtime():
return Runtime("test", None, {})
@pytest.mark.parametrize(
"expr, expected",
[
@ -17,11 +21,11 @@ import pytest
({"foo": "bar"}, {"foo": "bar"}),
],
)
def test_eval(expr, expected):
def test_eval(runtime, expr, expected):
assert (
eval(
Runtime("test", dict()),
Module("__repl__", dict()),
runtime,
Module("__repl__", [], dict()),
Bindings("__root__", None),
expr,
)
@ -29,11 +33,11 @@ def test_eval(expr, expected):
)
def test_hello_world(capsys):
def test_hello_world(capsys, runtime):
assert (
eval(
Runtime("test", {}),
Module("__repl__", {Symbol("print"): print}),
runtime,
Module("__repl__", [], {Symbol("print"): print}),
Bindings("__root__", None),
Apply(Symbol("print"), Args(["hello, world"], {})),
)

View file

@ -9,7 +9,6 @@ from lilith.parser import (
parser_with_transformer,
Symbol,
)
import pytest

View file

@ -2,7 +2,6 @@
from lilith.parser import Apply, Args, Block, Symbol
from lilith.reader import Module, read_buffer
import pytest
@ -12,7 +11,8 @@ import pytest
(
"""!def[main, lang[lil]]\nprint["hello, world"]\n""",
Module(
"&buff",
Symbol("&buff"),
[],
{
Symbol("main"): Block(
Apply(Symbol("lang"), Args([Symbol("lil")], {})),