From 3c7abc64f7ebdacd1a86b1a5a8fc4b156911c4dc Mon Sep 17 00:00:00 2001 From: elioat Date: Sun, 16 Feb 2025 16:20:24 -0500 Subject: * --- awk/scheme/scheme/bin/compiler.awk | 5 ++--- awk/scheme/scheme/bin/vm.awk | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'awk') diff --git a/awk/scheme/scheme/bin/compiler.awk b/awk/scheme/scheme/bin/compiler.awk index e7e8081..5371bb2 100755 --- a/awk/scheme/scheme/bin/compiler.awk +++ b/awk/scheme/scheme/bin/compiler.awk @@ -7,7 +7,7 @@ BEGIN { next_label = 0 program = "" - # Debug mode + # Debug mode, 0 off, 1 on DEBUG = 0 } @@ -15,7 +15,7 @@ function debug(msg) { if (DEBUG) printf("[DEBUG] %s\n", msg) > "/dev/stderr" } -# Process input line - just accumulate the raw input +# Process input line - accumulate the raw input { if (program != "") program = program "\n" program = program $0 @@ -29,7 +29,6 @@ END { split_expressions(program) } -# New function to handle multiple expressions function split_expressions(prog, current, paren_count, i, c, expr, cleaned) { current = "" paren_count = 0 diff --git a/awk/scheme/scheme/bin/vm.awk b/awk/scheme/scheme/bin/vm.awk index cb2b992..aa85280 100755 --- a/awk/scheme/scheme/bin/vm.awk +++ b/awk/scheme/scheme/bin/vm.awk @@ -1,6 +1,5 @@ #!/usr/bin/awk -f -# VM State Initialization BEGIN { # Type tags T_NUMBER = "N" @@ -10,24 +9,22 @@ BEGIN { T_FUNCTION = "F" T_NIL = "NIL" - # VM registers + # Registers stack_ptr = 0 # Stack pointer heap_ptr = 0 # Heap pointer pc = 0 # Program counter - # Debug mode + # Debug mode, 0 off, 1 on DEBUG = 0 # Environment for variables env_size = 0 - # Function table (make it persistent) delete func_name delete func_pc delete func_code func_size = 0 - # Call stack call_stack_ptr = 0 # State persistence -- cgit 1.4.1-2-gfad0