Closed kyleect closed 10 months ago
It would be really nice to be able to take the byte code the compiler outputs and visualize it as test
fn fizzBuzz(n) { for (var i = 1; i <= n; i = i + 1) { if (i % 15 == 0) { print "FizzBuzz"; } else if (i % 3 == 0) { print "Fizz"; } else if (i % 5 == 0) { print "Buzz"; } else { print i; } } } fizzBuzz(100);
0000 OP_CLOSURE 0 == '<function fizzBuzz>' 0002 OP_DEFINE_GLOBAL 1 == 'fizzBuzz' 0004 OP_GET_GLOBAL 1 == 'fizzBuzz' 0006 OP_CONSTANT 2 == '100' 0008 OP_CALL 1 0010 OP_POP 0011 OP_NIL 0012 OP_RETURN
This is implemented in the docs page but there seems to be a weird issue with function names
Another weird issue
Both of those issues are solved. Closing this now. Will open future issues for new things.
It would be really nice to be able to take the byte code the compiler outputs and visualize it as test
Example