首页 | 本学科首页   官方微博 | 高级检索  
     

Lex和Yacc在软PLC开发系统中的应用
引用本文:李爽,王永章,马雄波. Lex和Yacc在软PLC开发系统中的应用[J]. 组合机床与自动化加工技术, 2006, 0(9): 30-34
作者姓名:李爽  王永章  马雄波
作者单位:哈尔滨工业大学,机电工程学院,哈尔滨,150001
摘    要:实现对PLC(可编程逻辑控制器)编程语言的编译是软PLC开发系统的主要功能和重要组成部分.文中待编译的PLC编程语言为符合国际标准的IEC1131-3规定的指令表(IL)语言。基于Linux操作系统,文章首先讨论了对指令表进行编译的步骤,分析了如何利用扫描程序生成软件Lex开发词法分析器,以及利用分析程序生成软件Yacc(Yet another compiler-compiler)开发语法分析器的方法,然后将二者结合起来,完成了对指令表的词法分析和语法分析,并给出了关键部分的程序片段,最后通过实例验证了方法的正确性及可行性。

关 键 词:软PLC  编译  指令表
文章编号:1001-2265(2006)09-0030-05
收稿时间:2006-03-31
修稿时间:2006-04-30

Application of Lex and Yacc in SoftPLC''''s Development System
LI Shuang,WANG Yong-zhang,MA Xiong-bo. Application of Lex and Yacc in SoftPLC''''s Development System[J]. Modular Machine Tool & Automatic Manufacturing Technique, 2006, 0(9): 30-34
Authors:LI Shuang  WANG Yong-zhang  MA Xiong-bo
Affiliation:School of Electromechanical Engineering, Harbin Institute of Technology, Harbin 150001, China
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.
Keywords:Lex  Yacc
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号