From 8de2d77d37760aa3d48fcda0fa3e26c6d3eff8d9 Mon Sep 17 00:00:00 2001 From: "Ben (X13/Arch)" Date: Sat, 6 May 2023 09:10:23 +0200 Subject: [PATCH] Fixed bytecode listing --- content/reference/core/generator.nuj | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/content/reference/core/generator.nuj b/content/reference/core/generator.nuj index a379efc..6dc701b 100644 --- a/content/reference/core/generator.nuj +++ b/content/reference/core/generator.nuj @@ -85,13 +85,21 @@ (defn closure-html-bytecode (f) (try (fn (err) - (fmt "

Error

Couldn't disassemble {}

" (closure/name f))) + (fmt "

Error

Couldn't disassemble {}

{}
" (closure/name f) (string/write err))) (def T (type-of f)) (when (or (= T :lambda) (= T :macro)) (def disassembly (disassemble f)) (when disassembly - (cat "

Bytecode

Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.

"
-               (pp-nujel disassembly :html)
+          (def pretty-disassembly (-> disassembly
+                                      (map (fn (op)
+                                               (fmt "{}{}"
+                                                    (string/write (car op))
+                                                    (pp-nujel (string/write (cdr op)) :html))))
+                                      (join "\n")))
+          (def pretty-disassembly (fmt "{}
AddressOperation
" + pretty-disassembly)) + (cat "

Bytecode listing

"
+               pretty-disassembly
                "
"))))) (defn generate-reference-for (f) -- 2.45.2