stackish
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
;------------------------------------------------------------------------------;
|
||||
|
||||
(def current-evaluation (r/atom []))
|
||||
(def current-index (r/atom 0))
|
||||
(def current-index (r/atom 5))
|
||||
|
||||
(def +split-width+ "4px")
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
|
||||
;------------------------------------------------------------------------------;
|
||||
|
||||
(defn Stack []
|
||||
[:div {:class "pane-content stack-view"}
|
||||
[:h1 "Stack"]])
|
||||
|
||||
(defn Dump []
|
||||
[:div {:class "pane-content dump-view"}
|
||||
[:h1 "Dump"]])
|
||||
@@ -49,6 +45,41 @@
|
||||
|
||||
;------------------------------------------------------------------------------;
|
||||
|
||||
(defn deref-addr [heap addr]
|
||||
(get heap
|
||||
(keyword (str addr))
|
||||
(str "<broken pointer: &" addr ">")))
|
||||
|
||||
(defn words [& ws]
|
||||
(->> ws
|
||||
(map str)
|
||||
(str/join \space)))
|
||||
|
||||
(defn ppr-node [heap n]
|
||||
(match n
|
||||
{:tag "NGlobal" :contents [arity code]}
|
||||
(words "Global" arity "<code>")
|
||||
|
||||
{:tag "NNum" :contents k}
|
||||
(words "Num" k)
|
||||
a (str "other" a)))
|
||||
|
||||
(defn StackEntry [heap addr]
|
||||
(let [node (deref-addr heap addr)]
|
||||
[:div {:class "stack-entry"}
|
||||
(ppr-node heap node)
|
||||
[:div {:class "stack-entry-addr"}
|
||||
(str "&" addr)]]))
|
||||
|
||||
(defn Stack [heap s]
|
||||
[:div {:class "pane-content stack-view"}
|
||||
[:<> (map (partial StackEntry heap) s)]])
|
||||
|
||||
#_ (swap! current-index #(+ % 1))
|
||||
#_ (swap! current-index #(- % 1))
|
||||
|
||||
;------------------------------------------------------------------------------;
|
||||
|
||||
(defn ppr-instr [{op :tag c :contents}]
|
||||
(str op " " c))
|
||||
|
||||
@@ -62,7 +93,9 @@
|
||||
|
||||
;------------------------------------------------------------------------------;
|
||||
|
||||
(defn GM [{code :_gmCode}]
|
||||
(defn GM [{code :_gmCode
|
||||
stack :_gmStack
|
||||
heap :_gmHeap}]
|
||||
[Root {:direction "horizontal"}
|
||||
[Pane {:order 0 :initialSize "0.333fr"}
|
||||
[Heap]]
|
||||
@@ -70,7 +103,7 @@
|
||||
[Pane {:order 2 :initialSize "0.333fr"}
|
||||
[Root {:direction "vertical"}
|
||||
[Pane {:order 0 :initialSize "0.8fr"}
|
||||
[Stack]]
|
||||
[Stack heap stack]]
|
||||
[Splitter {:order 1 :size +split-width+}]
|
||||
[Pane {:order 2 :initialSize "0.2fr"}
|
||||
[Code code]]]]
|
||||
|
||||
Reference in New Issue
Block a user