Show HN: Awk-JVM – A toy JVM in Awk
Author here.<p>As I wrote in the README, this uses GAWK instead of plain AWK. Conveniences of GAWK over AWK in a nutshell:
- functions
- several additional functions (eg. bit shifting)<p>But even GAWK lacks some things that are very common in other languages:
- no variable scope: imagine a calling another function in a for loop and the other function again running a for loop. if both loops use 'i' as the counter, good luck. the workaround for this is to declare the local variables as parameters that are not passed (and separate them with four spaces) 
- cannot return array from a function. the workaround is to use pass-by-reference (not sure if the precise definition is applicable here)
- arrays cannot be assigned to another variable. workaround is to loop over array and assign it value by value.<p>If anybody knows better workarounds, please let me know :)