\ UNNESTED BACKUS-NAUR FORMS \ NORMAL STACK PATTERN : w ( s -- after.s true | s false ) COND save-sem w IF 'tis ELSES 'taint THEN ; : w1&w2 ( s -- after.s true | s false ) COND save-sem w1 IF w2 IF 'tis ELSES 'taint THEN ; : w1&w2&w3&w4 ( s -- after.s true | s false ) COND save-sem w1 IF w2 IF w3 IF w4 IF 'tis ELSES 'taint THEN ; : b1|b2 ( s -- after.s true | s false ) COND b1 NIF b2 ELSES true THEN ; : b1|b2|b3 ( s -- after.s true | s false ) COND b1 NIF b2 NIF b3 ELSES true THEN ; : w&u ( s -- after.s true | s false ) COND save-sem w IF u 'tis ELSES 'taint THEN ; : w1&w2&u ( s -- after.s true | s false ) COND save-sem w1 IF w2 IF u 'tis ELSES 'taint THEN ; : w1&w2&w3&u ( s -- after.s true | s false ) COND save-sem w1 IF w2 IF w3 IF u 'tis ELSES 'taint THEN ; \ UPTO STACK PATTERN \ These usually appear as unnamed string arguments nested in \ templates, not as colon definitions like those below. : {b} ( s -- after.s | s ) BEGIN b NUNTIL ; : [b] ( s -- after.s | s ) \ b drop ; \ The value of MAX-UNROLL is 2. : {2:b} ( s -- after.s | s ) \ b drop b drop ; : {3:b} ( s -- after.s | s ) 3 0 DO b drop LOOP ; \ NESTED EXAMPLES : (w1&w2)|b ( s -- after.s true | s false ) COND COND save-sem w1 IF w2 IF 'tis ELSES 'taint THEN NIF b ELSES true THEN ; : ((w1&w2)|b)&w3 ( s -- after.s true | s false ) COND save-sem COND COND save-sem w1 IF w2 IF 'tis ELSES 'taint THEN NIF b ELSES true THEN IF w3 IF 'tis ELSES 'taint THEN ; : b|(w1&w2) ( s -- after.s true | s false ) COND b NIF COND save-sem w1 IF w2 IF 'tis ELSES 'taint THEN ELSES true THEN ; \ The last argument line here is long enough to be \ a candidate for hand-editing. : w1&(b|(w2&w3)) ( s -- after.s true | s false ) COND save-sem w1 IF COND b NIF COND save-sem w2 IF w3 IF 'tis ELSES 'taint THEN ELSES true THEN IF 'tis ELSES 'taint THEN ; : b1|(w1&w2)|b2 ( s -- after.s true | s false ) COND b1 NIF COND save-sem w1 IF w2 IF 'tis ELSES 'taint THEN NIF b2 ELSES true THEN ; : (b1|b2)&(b3|b4) ( s -- after.s true | s false ) COND save-sem COND b1 NIF b2 ELSES true THEN IF COND b3 NIF b4 ELSES true THEN IF 'tis ELSES 'taint THEN ; : (b1|b2)&{b3} ( s -- after.s true | s false ) COND save-sem COND b1 NIF b2 ELSES true THEN IF BEGIN b3 NUNTIL 'tis ELSES 'taint THEN ; : w&{b} ( s -- after.s true | s false ) COND save-sem w IF BEGIN b NUNTIL 'tis ELSES 'taint THEN ; : w&[b] ( s -- after.s true | s false ) COND save-sem w IF \ b drop 'tis ELSES 'taint THEN ; : w&{2:b} ( s -- after.s true | s false ) COND save-sem w IF \ b drop b drop 'tis ELSES 'taint THEN ; : u1&u2&b1|b2 ( s -- after.s true | s false ) COND COND save-sem u1 u2 b1 IF 'tis ELSES 'taint THEN NIF b2 ELSES true THEN ; : u&b&w ( s -- after.s true | s false ) COND save-sem u b IF w IF 'tis ELSES 'taint THEN ; : u1&b&u2 ( s -- after.s true | s false ) COND save-sem u1 b IF u2 'tis ELSES 'taint THEN ; : u&{b1}&b2&w ( s -- after.s true | s false ) COND save-sem u1 BEGIN b1 NUNTIL b2 IF w IF 'tis ELSES 'taint THEN ; : w1&w2&{b1}&u&[b2] ( s -- after.s true | s false ) COND save-sem w1 IF w2 IF BEGIN b1 NUNTIL u \ b2 drop 'tis ELSES 'taint THEN ; : (u1&{w1&u2&u3}&w2)|b ( s -- after.s true | s false ) COND COND save-sem u1 BEGIN COND save-sem w1 IF u2 u3 'tis ELSES 'taint THEN NUNTIL w2 IF 'tis ELSES 'taint THEN NIF b ELSES true THEN ;