diff options
Diffstat (limited to 'awk/forth/f.awk')
-rwxr-xr-x | awk/forth/f.awk | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/awk/forth/f.awk b/awk/forth/f.awk index 4675925..3184dde 100755 --- a/awk/forth/f.awk +++ b/awk/forth/f.awk @@ -1,11 +1,18 @@ #!/usr/bin/awk -f +# I wanted to implement something non-trivial using awk. +# If I was clever I wouldn’t implement forth directly in awk, +# instead I’d implement a simple virtual machine using awk, +# and then implement the forth using the virtual machine’s byte code +#…but there is only so much brain power I can exert on such a silly project. + BEGIN { # Initialize stacks and dictionaries stack_ptr = 0 dict_size = 0 - # Built-in words, and some documentation (I could use stack comments, but I find those sort of unintuitive) + # Built-in words, and some documentation (I could use stack comments, + # but I find those sort of unintuitive) dict["+"] = "+ : Adds the top two numbers on the stack." dict["-"] = "- : Subtracts the top number from the second top number on the stack." dict["*"] = "* : Multiplies the top two numbers on the stack." |