Implement INTERCAL's Binary Operators
Python 2, 115 112 bytes



x,y,z=input().split()
d=y&lt;""
f=lambda a,b:a+b and(b%2+5&amp;4-d)*f(a/2,b/2)+(a%2*2+b%2)/3**d
print f(int(x),int(z))


The string on the second line contains a single unprintable character \x7d, the next char after ~.

All hopes of a nice, single lambda get crushed by the input format. There's probably a better way to read in input. Input like "51234 ¢ 60003" via STDIN.

The function f combines the following two recursive functions:

g=lambda a,b:a+b and 4*g(a/2,b/2)+a%2*2+b%2    # ¢
h=lambda a,b:a+b and(b%2+1)*h(a/2,b/2)+a*b%2   # ~


(-3 bytes with the help of @xnor)