use zscan instead of strscan; finish most of code generation