[ANN] MonkeyLang.jl

For the record, here is my quick-and-dirty bash command (updated to get filename and line number in front) to analyze .mem files

(cd mems; for F in *.mem; do awk '{printf "%-20s %4.4d %s\n",FILENAME,NR,$0}' $F;done) | sort -nr -k3 >r.anamem.txt

Here are the results (2nd col. is line number in filename, 3rd col. is number of allocs)

vm.jl.408.mem        0091 11066672288             const_id = read_uint16(ins[ip+1:ip+2]) + 1
vm.jl.408.mem        0116 6688797472             pos = read_uint16(ins[ip+1:ip+2])
vm.jl.408.mem        0032 6415057712         vm.stack[vm.sp[]] = obj
vm.jl.408.mem        0103 6323812608             execute_binary_operation!(vm, op, left, right)
vm.jl.408.mem        0093 4742859504                 push!(vm, vm.constants[const_id])
vm.jl.408.mem        0148 4026202560                 push!(vm, vm.stack[frame.base_ptr+local_id])
vm.jl.408.mem        0209 1433313696             push!(vm, return_value)
vm.jl.408.mem        0324 477771248         frame = Frame(cl, vm.sp[] - arg_count)
lexer.jl.408.mem     0031     13440         ch, state = l.next
lexer.jl.408.mem     0135      5088     while isspace(read_char(l))
lexer.jl.408.mem     0103      3520         push!(chars, read_char(l))
vm.jl.408.mem        0030      3104         push!(vm.stack, obj
...

Sorry its Linux script, I am an old linuxer. I should have written that in Julia … next time surely

2 Likes