From 9c737e0be1b693dc33c0cc1270f65b8798c12252 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 24 Sep 2024 22:59:14 +0200 Subject: [PATCH] More polite code --- README.md | 0 example.scm | 28 ++++++++++++++-------------- tigerscheme.tig | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) mode change 100755 => 100644 README.md mode change 100755 => 100644 example.scm mode change 100755 => 100644 tigerscheme.tig diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/example.scm b/example.scm old mode 100755 new mode 100644 index 7c42d9b..6df20f3 --- a/example.scm +++ b/example.scm @@ -371,7 +371,7 @@ (eqv-test "eqv? inter-types" '( (#f 2 a) - (#f 4 "Derp") + (#f 4 "Test") (#f () (a b)) (#f 9 ()) )) @@ -627,7 +627,7 @@ (result (cadar rules)) (bindings (find-variable-bindings literals var-name (caar rules))) ) - (begin (display "Derp: ") + (begin (display "Test ") (display bindings) (newline) @@ -694,16 +694,16 @@ ( #t . ,(bool 1)) )) -(define-syntax derp +(define-syntax fun_macro (syntax-rules (two) - ((derp) 1) - ((derp two) (+ (derp) (derp))) + ((fun_macro) 1) + ((fun_macro two) (+ (derp) (derp))) )) (test "Defining weird macroes using syntax-rules." `( - ( 1 . ,(derp)) - ( 2 . ,(derp two)) + ( 1 . ,(fun_macro)) + ( 2 . ,(fun_macro two)) )) (define-syntax +1 @@ -717,18 +717,18 @@ ( 0 . ,(+1 -1)) )) -(define-syntax derp +(define-syntax fun_macro (syntax-rules () - ((derp a) a) - ((derp a b ...) (+ a (derp b ...))) + ((fun_macro a) a) + ((fun_macro a b ...) (+ a (derp b ...))) )) (test "Defining list using syntax-rules." `( - ( 1 . ,(derp 1)) - ( 6 . ,(derp 6)) - ( 9 . ,(derp 4 5)) - ( 3 . ,(derp 1 1 1)) + ( 1 . ,(fun_macro 1)) + ( 6 . ,(fun_macro 6)) + ( 9 . ,(fun_macro 4 5)) + ( 3 . ,(fun_macro 1 1 1)) )) (exit) diff --git a/tigerscheme.tig b/tigerscheme.tig old mode 100755 new mode 100644 index da3b28a..0322c60 --- a/tigerscheme.tig +++ b/tigerscheme.tig @@ -633,7 +633,7 @@ let /* Booleans */ else if is_char(",", index) then "unquote" else ( parse_error("Internal error: Unknown quick modifier") - ; "SOMETHING FUCKED UP") + ; "PARSING_ERROR") var datum := ( index := index + 1 ; if modifier = "unquote-splicing" then index := index + 1 @@ -2035,17 +2035,17 @@ let /* Booleans */ , ast) ; TRIGGERED_EXIT := true ; nil ) - else let var derp: scheme_value := nil + else let var stack_top: scheme_value := nil in vm_run(macro_tape, fun.val_i, stack, fun.val_car, "", env_global) ; /* TODO: Assert that there is something on the stack */ - derp := stack_pop(stack) + stack_top := stack_pop(stack) ; if DEBUG_PRINT_MACRO then ( print("Macro \"") ; print(ast.val_car.val_s ) ; print("\" expanded to: ") - ; print(value_to_string(derp)) + ; print(value_to_string(stack_top)) ; print("\n") ) - ; compile_rec(derp, can_tail_call, type_any) + ; compile_rec(stack_top, can_tail_call, type_any) end end