流程图与类C语言实时转换方法-东南大学学报.PDF
文本预览下载声明
第39卷第3期 东南大学学报(自然科 学版 ) Vol39 No3
2009年5月 JOURNALOFSOUTHEASTUNIVERSITY(NaturalScienceEdition) May2009
doi:10.3969/j.issn.1001-0505.2009.03.016
流程图与类C语言实时转换方法
钟志超 张志胜 戴 敏 曹 杰 史金飞
(东南大学机械工程学院,南京211189)
摘要:为了融合图形化和文本语言2种编程方式的优点,提高教育机器人编程平台的直观性和
通用性,结合编程平台要求,设计出流程图与类C语言双向实时转换方法.在进行流程图到类C
语言转换时,实时根据各个模块间的父子关系遍历模块树,并根据功能模块封装的库函数和语句
完成转换,在转换过程中实时进行类C语言规则检查.在进行类C语言到流程图转换时,首先通
过词法分析、语法分析和语义分析生成XML代码,再进行统一解析生成流程图.在转换过程中
实时进行错误检查,出现错误所在行会高亮显示以提示用户,并给出错误原因以便于用户修改程
序.最后,通过典型结构转换实例和应用,验证了所提出方法的有效性和正确性.
关键词:流程图;类C语言;XML;实时转换
中图分类号:TP311 文献标志码:A 文章编号:1001-0505(2009)03050206
RealtimeconversionmethodforflowchartandsimilarClanguage
ZhongZhichao ZhangZhisheng DaiMin CaoJie ShiJinfei
(SchoolofMechanicalEngineering,SoutheastUniversity,Nanjing211189,China)
Abstract:AnewrealtimeconversionmethodforaflowchartandasimilarClanguageisproposed
torealizetheversatilityofaprogrammingplatformofeducationalrobotsbytheintegrationofgraph
icsandtextprogramming.DuringtheprocessofconvertingtheflowcharttoasimilarClanguage,
themoduletreeisscannedaccordingtotherelationshipsbetweenmodules;moreover,theconverting
resultsareachievedandcheckedbythelibraryfunctionandtheruleofthesimilarClanguage.Dur
ingtheprocessofconvertingthesimilarClanguagetotheflowchart,anXML(eXtensiblemarkup
language)codeisgeneratedbylexicalanalysis,syntaxanalysisandsemanticanalysis;then,aflow
chartisbuiltviaanXMLparser.Besides,realtimeerrorchecksarecarriedouttohighlighttheerror
lineandprompttheuserofthewrongreason.Finally,anexampleoftheconversionofatypical
structureisgiventoillustratethevalidityandefficiencyofthemethod.
Keywords:flowchart;similarClanguage;eXtensiblemarkuplanguage;realtimeconversion
显示全部