write codes by ply (python-lex-yacc)