针对嵌入式数控系统运行过程中对NC代码解释的高准确率与高效率的要求,基于自顶向下的递归下降分析法,提出一种应用于嵌入式数控系统NC代码编译器的设计方法.文章主要分别从词法分析、语法分析和解释执行等方面进行编译器的设计与实现.实际运行结果表明:该方法能够高效地构建编译器,可快速、准确地对NC代码进行编译,具有良好的可移植性;为嵌入式数控系统的NC代码编译提供了一种简单有效的解决方案.%In allusion to the demand for high precision and high efficiency of the NC code compiler from the NC system, based on the top-down analysis method of recursive descent grammar, a novel design of general NC code complier in embedded NC system is presented. The design and implementation of compiler are described from different aspects: lexical analysis, syntax analysis, interpreted executing and so on. The practical results show that the method can construct the compiler efficiently, compile the NC code faster and more correctly, owned fine portability; which provides a simple and effective solution for NC code compiler in embedded NC system.
展开▼