diff --git a/README.md b/README.md index 9e3f268..5eb0759 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Lamb treats each λ expression as a binary tree. Variable binding and reduction ## Todo (pre-release, in this order): - - Prettier colors + - Fix :save - Cleanup warnings - Truncate long expressions in warnings - Prevent macro-chaining recursion @@ -83,6 +83,7 @@ Lamb treats each λ expression as a binary tree. Variable binding and reduction - step-by-step reduction - Cleanup files - Update screenshot + - Update documentation & "internals" section. - PyPi package diff --git a/lamb/__main__.py b/lamb/__main__.py index d0c58da..651c6cd 100755 --- a/lamb/__main__.py +++ b/lamb/__main__.py @@ -36,7 +36,7 @@ r = lamb.Runner( key_bindings = bindings ), prompt_message = FormattedText([ - ("class:prompt", "~~> ") + ("class:prompt", "==> ") ]) ) diff --git a/lamb/commands.py b/lamb/commands.py index 949943a..6737a7c 100644 --- a/lamb/commands.py +++ b/lamb/commands.py @@ -103,7 +103,7 @@ def cmd_load(command, runner): for i in range(len(lines)): l = lines[i] try: - x = runner.parse(l) + x = runner.parse(l)[0] except ppx.ParseException as e: printf( FormattedText([ diff --git a/lamb/runner.py b/lamb/runner.py index 478cd1c..4057575 100644 --- a/lamb/runner.py +++ b/lamb/runner.py @@ -129,7 +129,10 @@ class Runner: ("class:warn", "\n") ] - only_macro = isinstance(node.left, lamb.node.Macro) + only_macro = ( + isinstance(node.left, lamb.node.Macro) or + isinstance(node.left, lamb.node.Church) + ) if only_macro: stop_reason = StopReason.SHOW_MACRO m, node = lamb.node.expand(node, force_all = only_macro) @@ -181,21 +184,21 @@ class Runner: if only_macro: out_text += [ - ("class:result_header", f"Displaying macro content") + ("class:ok", f"Displaying macro content") ] else: out_text += [ - ("class:result_header", f"Runtime: "), + ("class:ok", f"Runtime: "), ("class:text", f"{time.time() - start_time:.03f} seconds"), - ("class:result_header", f"\nExit reason: "), + ("class:ok", f"\nExit reason: "), stop_reason.value, - ("class:result_header", f"\nMacro expansions: "), + ("class:ok", f"\nMacro expansions: "), ("class:text", f"{macro_expansions:,}"), - ("class:result_header", f"\nReductions: "), + ("class:ok", f"\nReductions: "), ("class:text", f"{k:,}\t"), ("class:muted", f"(Limit: {self.reduction_limit:,})") ] @@ -206,7 +209,7 @@ class Runner: only_macro ): out_text += [ - ("class:result_header", "\n\n => "), + ("class:ok", "\n\n => "), ("class:text", str(node)), # type: ignore ] @@ -230,7 +233,7 @@ class Runner: if not silent: printf(FormattedText([ ("class:text", "Set "), - ("class:syn_macro", macro.label), + ("class:code", macro.label), ("class:text", " to "), ("class:text", str(macro.expr)) ]), style = lamb.utils.style) diff --git a/lamb/utils.py b/lamb/utils.py index 9a0f84e..f70bbee 100644 --- a/lamb/utils.py +++ b/lamb/utils.py @@ -7,31 +7,23 @@ from importlib.metadata import version style = Style.from_dict({ # type: ignore # Basic formatting "text": "#FFFFFF", - "warn": "#FFFF00", - "err": "#FF0000", - "prompt": "#00FFFF", - "ok": "#B4EC85", + "warn": "#FFA700", + "err": "#FF3809", + "prompt": "#05CFFF", + "ok": "#00EF7C", "code": "#AAAAAA italic", "muted": "#AAAAAA", - # Syntax - "syn_macro": "#FF00FF", - "syn_lambda": "#FF00FF", - "syn_bound": "#FF00FF", - - # Titles for reduction results - "result_header": "#B4EC85 bold", - # Command formatting # cmd_h: section titles # cmd_key: keyboard keys, usually one character - "cmd_h": "#FF6600 bold", - "cmd_key": "#B4EC85 bold", + "cmd_h": "#FF3809 bold", + "cmd_key": "#00EF7C bold", # Only used in greeting - "_v": "#B4EC85 bold", - "_l": "#FF6600 bold", - "_s": "#B4EC85 bold", + "_v": "#00EF7C bold", + "_l": "#FF3809 bold", + "_s": "#00EF7C bold", "_p": "#AAAAAA" })