2 ms·
I copy your code below, because it's so terse and marvellous and I don't want to deprive anyone who assumes otherwise and doesn't click on your link: : >BR
by Y_Y 2y ago
I copy your code below, because it's so terse and marvellous and I don't want to deprive anyone who assumes otherwise and doesn't click on your link:
: >BRACES 1 CELLS BRACES +! BRACES @ ! ;
: BRACES> BRACES @ @ -1 CELLS BRACES +! ;
: { DEPTH >BRACES ;
: } DEPTH BRACES> 1+ <> ABORT"unbalanced" ;
And the example "backwards lisp" expressions you give as test cases:
{ 1 2 + } .
{ 5 { 1 2 + } * }