Bracket Matching by testprogram

main=interact$unlines.map(b[]).lines
b[][]="yes";
b[](a:x)|o a=b[a]x|1<2="failed at: "++a:x
b(c:z)(a:x)|d c a=b z x|o a=b(a:c:z)x|1<2="failed at: "++a:x
b _ _="failed at: EOL"
o a=filter(==a)"([{<"/=[]
d a c=filter(==(a,c))(zip"([{<"")]}>")/=[]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top