aboutsummaryrefslogtreecommitdiffstats
path: root/awk
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2025-02-16 16:20:24 -0500
committerelioat <elioat@tilde.institute>2025-02-16 16:20:24 -0500
commit3c7abc64f7ebdacd1a86b1a5a8fc4b156911c4dc (patch)
treec269aba5642a90d55f4f533f919f834b655e0f65 /awk
parentfd6333ed6640fcc23a8f1a92a49cf45e13c96f17 (diff)
downloadtour-3c7abc64f7ebdacd1a86b1a5a8fc4b156911c4dc.tar.gz
*
Diffstat (limited to 'awk')
-rwxr-xr-xawk/scheme/scheme/bin/compiler.awk5
-rwxr-xr-xawk/scheme/scheme/bin/vm.awk7
2 files changed, 4 insertions, 8 deletions
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