节点文献
Lex和Yacc在软PLC开发系统中的应用
Application of Lex and Yacc in SoftPLC’s Development System
【摘要】 实现对PLC(可编程逻辑控制器)编程语言的编译是软PLC开发系统的主要功能和重要组成部分,文中待编译的PLC编程语言为符合国际标准的IEC1131-3规定的指令表(IL)语言。基于Linux操作系统,文章首先讨论了对指令表进行编译的步骤,分析了如何利用扫描程序生成软件Lex开发词法分析器,以及利用分析程序生成软件Yacc(Yet another compiler-compiler)开发语法分析器的方法,然后将二者结合起来,完成了对指令表的词法分析和语法分析,并给出了关键部分的程序片段,最后通过实例验证了方法的正确性及可行性。
【Abstract】 Compiling PLC(Programmable Logic Controller) program languages is one of the most important part and target of SoftPLC’s development system.The language to be compiled is Instruction List(IL) which is canonical and ordained by IEC1131-3.The research is based on Linux operating system.The process of IL program’s compiling is studied firstly.How to automatically develop a token analyzer with the help of Lex and a syntax analyzer with the help of Yacc(Yet another compilercompiler) is discussed in the paper.Then PLC programme’s compiling can be realized with the combination of them.Some central programme segments which are pertaining to Instruction List language are exemplified.The validity and feasibility of the method given in the paper are testified with some examples.
- 【文献出处】 组合机床与自动化加工技术 ,Modular Machine Tool & Automatic Manufacturing Technique , 编辑部邮箱 ,2006年09期
- 【分类号】TM571.61
- 【被引频次】6
- 【下载频次】162