aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-10 15:32:27 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-10 15:48:20 -0400
commit3a5a04de228bed74637d5735e49c9b21422028ba (patch)
tree0bdf50c6123ea46e548e7882129b4015fc09cd0a /src
parentd6abe6879f53763bb1283a7721676be9e7f6c27c (diff)
Enable LOCU instruction (31) to read and clear variable slot
Diffstat (limited to 'src')
-rw-r--r--src/c.bqn5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/c.bqn b/src/c.bqn
index 1bb35e31..d6eed79c 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -138,7 +138,7 @@ Parse ← {r‿vn‿i‿e←𝕨⋄nv←≠vn
fi←+`b←br>0⋄c←/br<0 # Block Begin (mask) and Close (index), in matching order
# Block properties
- H←¬1(∾/∾˜)b(∨/⊣)= # Which blocks have a property
+ PN←1(∾/∾˜)(∨/⊣)⋄H←b¬∘PN= # Which blocks have a property
sn←(0‿3‿4‿5+5+⊑bI)⍋𝕩⋄sp←/𝕩 M bI # Special name index
fx←1 H sn⋄fr←(fx∨0⊸<)⊸+ft←(2⊸H⌈2×3⊸H)sn # Block immediacy ¬fx and type ft
"Special name outside of any block"_err_(/{(0=fi)∧𝕩 M bI}∘𝕩) 0<⊑fr
@@ -203,8 +203,9 @@ Parse ← {r‿vn‿i‿e←𝕨⋄nv←≠vn
lc←(1«b)/dn←b(⊢-T)+`idm∧ac M 2‿4 # Locals Count
idd←(id-○(⊏⟜fd)id≠⊸↑ui)∾zic∾0¨sp # Identifier frame depth
idi←(ui⊏(fi⊏fsc)+dn-1)∾((sp⊏fi)⊏3×fx)++⟜(0⊸≤)2+sp⊏xv # Slot within frame
+ uu←(ip∾zic)(((1«d)∧0=⊣)∧d(⊣+`⊸⊏PN)0<⊢)⌾(ig⊸⊏)idd # Unused marker
# Generate code to load identifiers and list each module's extracted exports
- ib←⟨21+0<ip∾zic∾sp⊏ac,idd,idi⟩ # Identifier bytecode: instruction, depth, slot
+ ib←⟨(10×uu)+21+0<ip∾zic∾sp⊏ac,idd,idi⟩ # Identifier bytecode: instruction, depth, slot
ed←/¯1⊸»⊸<ex # Select first export in each module
idor←∾¯1⌽1‿3/⟨3/id∾ex∾sp,ed⊏ex⟩ # Identifier bytecode ordering
idbc←¯1⌽⟨⥊⍉>ib,3¨ed,ex≠⊸(«-⊢)ed,14¨ed⟩ # and bytecode