Font Size: a A A

Design And Implementation Of The Fee Calculate Engine Baesed On Script Language

Posted on:2010-03-02Degree:MasterType:Thesis
Country:ChinaCandidate:C ZhangFull Text:PDF
GTID:2178360278462575Subject:Software engineering
Abstract/Summary:PDF Full Text Request
With the rapid development of science and technology, the software and hardware technology are used in a growing number of computer fields. The script language and technology has its historic stories. Depend on hardware upgrading, script language is able to be used in more and more fields. This thesis is about how to use script language to pay fee on a device, which is an embedded environment. The purpose to use script language is to improve the ability of product customization and reform the structure of products.There are two characters of script language to implement the function of payment device. The first one is to support hash table and automatically memory management. The other one is to support code compilation. So the two topics of this thesis are heap management with garbage collection and script code compiled to byte code.In the section of heap management, according to analysis the character of script language, the mainly used data structure in script language environment is hash table with garbage collection on heap. At the first of all, the primary character of hash table is introduced. Then the hash function, the storage format and operation method of hash table are discussed. Specially, the efficiency of hash table with different storage format is focused. With deeply researching, the better format of hash table is to store the index part and data part in independent memory space with different garbage collection algorithm. And the index part of hash table had better be stored with two level index schemas. The hash table with the finally storage format is able to allocate lower memory, even if it has a small or large number of items.In the section of script code compilation, the basic steps of compiler principles are introduced at first. After that, the thesis discuss about instruction set of Lua language and its advantage. The main part of this section is to compile the c-like script code to the lua-like byte code in one-pass method with lex and yacc. There are 3 points: 1)use branch method to generate register base instruction set; 2) use short-circuit boolean method to implement relational operation; 3) move const string from function base const area to global const area and update the instruction set.After above two sections, there are several basic interface functions defined in script engine. Base on them, the optimizing methods of compiling, initialing and running phase are described. In running phase, a special algorithm of garbage collection is used according to the character of payment script engine. The algorithm is adjust the time to run original algorithm to reduce the affection of garbage collection.To calcate fee by scripts is a new development way than before. This thesis explains that it is practicable solution according to an instance of fee calc script engine designed and implemented. There are two contribution in this thesis. 1. To create a hash table module for embedded system. The functions of module are data struct, memory allocated and garbage collection of hashtable. The characters of hash table is lower memory usage with permitted running speed. Then the timing of garbage collection is investigated and adjusted according to characters of engine. 2. To compile fee calc scrript to lua-like instruction set by lex and yacc. The set is new and be used widely around the world, so the details of compiler is introduced necessarily. According to investigation and research, the const string data are moved from local const region to global const region.
Keywords/Search Tags:Script Language, Script Engine, Garbage Collection, Compiler, LUA, J2ME
PDF Full Text Request
Related items