Aimed at the problem that there is no efficient program learning software in the education market, leading to many programming problems cannot be solved quickly and accurately, the paper researched and proposed the recognition and analysis algorithms based on OCR (Optical Character Recognition) technology and programming knowledge base. Based on the proposed method, we developed an intelligent mobile software for programming learning. The main function of the software includes code recognition through photographing and programming exercises. After the software unit test and system integration test, it was found that the method can be excellent for code recognition and extraction. And it proved that code assistant software based on recognition analysis algorithm can solve the programming problem quickly and accurately.