offline code,combine lex and tex,and using queue