##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: September, 2016 # Modified: 2016-10-03/22:38-0400 ##+ # # Bal.icn, demonstrate the SNOBOL style balanced parentheses pattern # procedure main() pat := Len(2) || Bal() -> b || Rem() -> r write(image(pat)) tests := ["a=(b*c)+d", "a=b*c+d", "a=()+d"] every subject := !tests do { write("Matching : ", subject) subject ?? pat write("balanced part: ", b) write("remainder : ", r) } end