From 1d41d31180e625aa5a34148d8d87adbf1a32a650 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 8 Aug 2021 22:14:50 -0400 Subject: Draft-ish label handling --- src/c.bqn | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/c.bqn b/src/c.bqn index 16ad837f..74c1ee2b 100644 --- a/src/c.bqn +++ b/src/c.bqn @@ -156,18 +156,21 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn "Punctuation : and ; not allowed outside blocks"_err_(↕∘≠) (∨`b)¯1↓ch - "Headers unsupported for now!"_err_(↕∘≠) hh cc←(⍋⍋«co)⊏c∾/cs + "Non-label headers unsupported for now!"_err_(↕∘≠) hh>»(𝕩 M bI+0‿nv)∧hf + hr←0∾(hf/rev)⊏r⋄hf∧↩«hh⋄hu←(𝕩 M bI)fx "Block bodies must be of the same kind"_err_(/CB) 1↓cf<»⊸≠ft - "Special name outside of any block"_err_(/{(0=fi)∧𝕩 M bI}∘𝕩) 0<⊑fr fsc←(ft⊏0‿2‿3)+3×fx # Special name count # Propagate roles through parentheses @@ -210,7 +213,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn "Role of the two sides in assignment must match"_err_(at⊏G) af∧ar≠0⌈at⊏er aid←(¯6⊸≤∧<⟜nv)𝕩-vi # Assignable identifer ak←af+(0≤ar)+(⊑bG)-˜ai⊏𝕩 # Class of assignment: 1⇐ 2⇐? 3←? 4↩? - aa←×g⊏ac←»+`(»⊸∨0=+`)⊸×gi⊏«⊸-ak⌾(at⊸⊏)0¨𝕩 # ac broadcasts it to the entire target + aa←×g⊏ac←(3×hu)+»+`(»⊸∨0=+`)⊸×gi⊏«⊸-ak⌾(at⊸⊏)0¨𝕩 # ac broadcasts it to the entire target nf←H achu)∨dm∨gi⊏«aa∧a)<(0⊸≤∧<⟜nv)xv # Identifier indices in xv sa←0)ia∾sa # Opcode idoc←⟨26¨di,di⊏xv, ido,idd∾0¨sp,idi∾spi⟩ # Identifier bytecode: instruction, depth, slot + idor∾˜↩3/hi←/hu∧0∨|)ps(⊢-T)+`¬ro # Train argument (first-level) -- cgit v1.2.3