{"title":"类c语言解释器的设计与实现","authors":"Xiaohong Xiao, You Xu","doi":"10.1109/IPTC.2011.33","DOIUrl":null,"url":null,"abstract":"This paper designs and implements a C-like language interpreter using C++ based on the idea of modularity. The whole system can be divided into three modules, namely, lexical analyzer, syntactic analyzer and evaluation of expression. During the design, token is being used. The design puts great emphasis towards code reusability and extensibility, which makes it easy to embed the code into other C++ programs. The final testing result shows that the implemented interpreter realizes almost all the interpretation functions of C-like language, including the interpretation of interface function call. It can also be used as script engine of games to control game logic through text, and games can be modified during running without recompiling the source code. Moreover, it has good portability. It can successfully run on different operating systems like Windows XP, MAC OS X 10.6.1, and iPhone OS 3.0.","PeriodicalId":388589,"journal":{"name":"2011 2nd International Symposium on Intelligence Information Processing and Trusted Computing","volume":"84 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-10-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":"{\"title\":\"The Design and Implementation of C-like Language Interpreter\",\"authors\":\"Xiaohong Xiao, You Xu\",\"doi\":\"10.1109/IPTC.2011.33\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"This paper designs and implements a C-like language interpreter using C++ based on the idea of modularity. The whole system can be divided into three modules, namely, lexical analyzer, syntactic analyzer and evaluation of expression. During the design, token is being used. The design puts great emphasis towards code reusability and extensibility, which makes it easy to embed the code into other C++ programs. The final testing result shows that the implemented interpreter realizes almost all the interpretation functions of C-like language, including the interpretation of interface function call. It can also be used as script engine of games to control game logic through text, and games can be modified during running without recompiling the source code. Moreover, it has good portability. It can successfully run on different operating systems like Windows XP, MAC OS X 10.6.1, and iPhone OS 3.0.\",\"PeriodicalId\":388589,\"journal\":{\"name\":\"2011 2nd International Symposium on Intelligence Information Processing and Trusted Computing\",\"volume\":\"84 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2011-10-22\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"2\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2011 2nd International Symposium on Intelligence Information Processing and Trusted Computing\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/IPTC.2011.33\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2011 2nd International Symposium on Intelligence Information Processing and Trusted Computing","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/IPTC.2011.33","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2
摘要
本文基于模块化思想,用c++语言设计并实现了一个类C语言解释器。整个系统可分为三个模块,即词法分析器、句法分析器和表达式求值。在设计期间,使用令牌。该设计非常强调代码的可重用性和可扩展性,这使得将代码嵌入到其他c++程序中变得很容易。最终的测试结果表明,所实现的解释器几乎实现了类c语言的所有解释功能,包括接口函数调用的解释。它也可以作为游戏的脚本引擎,通过文本来控制游戏逻辑,并且可以在运行过程中修改游戏,而无需重新编译源代码。此外,它具有良好的可移植性。它可以在Windows XP、MAC OS X 10.6.1和iPhone OS 3.0等不同的操作系统上成功运行。
The Design and Implementation of C-like Language Interpreter
This paper designs and implements a C-like language interpreter using C++ based on the idea of modularity. The whole system can be divided into three modules, namely, lexical analyzer, syntactic analyzer and evaluation of expression. During the design, token is being used. The design puts great emphasis towards code reusability and extensibility, which makes it easy to embed the code into other C++ programs. The final testing result shows that the implemented interpreter realizes almost all the interpretation functions of C-like language, including the interpretation of interface function call. It can also be used as script engine of games to control game logic through text, and games can be modified during running without recompiling the source code. Moreover, it has good portability. It can successfully run on different operating systems like Windows XP, MAC OS X 10.6.1, and iPhone OS 3.0.