"~=" is not a valid token in Jack. (There are no two character tokens except // /* and */.)
You need to code "not equals" as ~(a=dx).
Also, remember that there is no defined order of operation, so you need to fully parenthesize complex expressions.
while ( (~(a=dx)) | (~(b=dx)) )
Whitespace can really aid readability of Jack expressions!
--Mark