Title :
The Design and Implementation of C-like Language Interpreter
Author :
Xiao, Xiaohong ; Xu, You
Author_Institution :
Sch. of Math. & Comput. Sci., Huanggang Normal Univ., Huanggang, China
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.
Keywords :
C++ language; computer games; program interpreters; software reusability; C++; C-like language interpreter; code extensibility; code reusability; expression evaluation; game logic; games; interface function call; lexical analyzer; script engine; syntactic analyzer; Computers; Educational institutions; Engines; Games; High level languages; Syntactics; Testing; evaluation of expression; interpreter; lexical analyzer; syntactic analyzer;
Conference_Titel :
Intelligence Information Processing and Trusted Computing (IPTC), 2011 2nd International Symposium on
Conference_Location :
Hubei
Print_ISBN :
978-1-4577-1130-5
DOI :
10.1109/IPTC.2011.33