aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-06 14:42:14 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-10-06 14:42:14 -0400
commitf833879e33af01a0cf211b5d20bf3e0b5f302fee (patch)
treebff5146ace48af13475754c32894f7d4a6b86e16
parentbdf277e9acaa6f77b55c1a1331416f6e1d8e47a9 (diff)
Minor cleanup and simplify grade usage
-rw-r--r--src/c.bqn10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/c.bqn b/src/c.bqn
index 691fb6a7..61007e3a 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -106,13 +106,13 @@ ErrUndeclared←{
0 !˜ "Undefined identifier"∾(1<≠𝕩)/"s"
}
Parse ← {r‿nv←𝕨
- g←⍋pd←+`p←(¯1-2×r)×𝕩 M bB⋄pp←g⊏p×𝕩M⟨⊑bB,2⟩⋄gp←g⊏r=¯1
- (g⊏p)(=⟜1⊸/ErrMismatchedBrackets⍟≢1-˜=⟜¯1⊸/)gx←g⊏𝕩
+ g←⍋pd←+`p←(¯1-2×r)×𝕩 M bB⋄gp←g⊏p⋄gb←g⊏r=¯1⋄gx←g⊏𝕩
+ gp(>⟜0⊸/ErrMismatchedBrackets⍟≢1-˜<⟜0⊸/)gx
"Swapped open and closed brackets" ! 0≤(⊑g)⊑pd
- "Parentheses can't contain separators" ! ¬∨´((⊑bB)⊸=/·«sep⊸=)gp/gx
- "Empty statement or expression" ! ∧´(4+⊑bB)=(1⊸«⊸∧1∾gp)/0∾gx
+ "Parentheses can't contain separators" ! ¬∨´((⊑bB)⊸=/·«sep⊸=)gb/gx
+ "Empty statement or expression" ! ∧´(4+⊑bB)=(1⊸«⊸∧1∾gb)/0∾gx
"Invalid assignment or stranding use" ! ∧´(r≤¯2)/r»⊸∧⟜«○(0⊸≤)r+p
- rp←¬g⍋⊸⊏(pp>0)(/{𝕨⌾((pp<0)⊸/)𝕩}∧)(«⊢<1⊸«)⊸∧g⊏p>0
+ pp←gp×gx<2+⊑bB⋄rp←(¬(pp>0)(/{𝕨⌾((pp<0)⊸/)𝕩}∧)1‿0⊸«⊸∧)⌾(g⊸⊏)p>0
𝕩/˜↩rp⋄r/˜↩rp⋄g↩⍋+`p↩rp/p
sr←»⌾(g⊸⊏)sl←«⊸∨r=¯2⋄cp←𝕩=1+⊑bB
ps←sl∨r=¯1