摘要
SCPI(Standard Commands for Programmable Instrument)语言是一种用于可编程仪表的标准命令集,它定义了通过控制器和仪器通讯时使用的程控代码规则。如何正确地将SCPI语句解析为仪表内的操作和寄存器访问,是仪表接口设计中具有挑战性的工作之一。提出并实现了一种两级解析模型,即将SCPI语句的解析分为词法和语义分析两级。词法分析专注于关键字的提取并将其映射为内部代码,语义分析则专注于语义解释。该设计方法充分利用了SCPI语句的树形结构特点,并以费思泰克科技有限公司的电子负载FT6600为例,实现了一套简洁、高速的SCPI语言解析器。
SCPI,Standard Commands for Programmable Instrument,defines the rules of program codes that applied to the controller to communicate with instrument.Implementation that parsing SCPI sentence to internal operation or register accesses of the instrument correctly,is full of challenge during design of instrument interface.This paper presents and implements a two-level parsing model,which divides SCPI parser to word-level parser and syntax-level parser.Word-level parser concentrates on the distilling keywords and maps them to internal codes;syntax-level parser concentrates on the meaning of sentence expressed by internal codes.The design takes advantage of tree structure of SCPI sentence,and takes example of electrical load FT6600 of Shenzhen Faithtech CO.,LTD.,implements a compact,fast speed SCPI parser.
出处
《电子质量》
2008年第8期23-25,共3页
Electronics Quality