Design and Implementation of the Fee Calculate Engine Baesed on Script Language
- Author
- ZhangCheng
- Advisor
- WuGang , SunLianShan
- School
- Shanghai Jiaotong University
- Major
- Software Engineering
- Classification
- TP311.52 Software Development
- Degree
- Master's thesis
- Year
- 2009
- Downloads
- 66
- Citations
- 0
Abstract
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.
Table of contents
Summary 3-5
ABSTRACT 5-9
1 Introduction 9-12
1.1 subject background 9-10 <br / > 1.2 technology and solutions 10-11
1.3 main tasks 11-12
2 scripting language and billing engine 12-18 <br / > Overview 2.1 scripting language 12-13
2.2 with the traditional high-level programming language is relatively 13-15
2.3 billing system and billing engine 15 - 16
2.4 applies scripting language 16-17
2.5 Summary 17-18
3 billing scripting engine composition and memory management 18 - composed of 41
3.1 scripting engine and basic data structures 18-22
3.1.1 scripting language basic variables 19-20
3.1.2 stack variables storage 20-21
3.1.3 hash key and value variables achieve 21-22
3.2 hash table 22-35 <br / > 3.2.1 hash function storage format 22-24
3.2.2 hash table nbsp operation 24-28
3.2.3 hash table ; 28 - 29
3.2.4 billing scripting engine hash table 29-33
3.2.5 hash table to convert the array 33-35
3.3 with garbage collected heap manager 35-40
3.3.1 classical garbage collection algorithms 35-36
3.3.2 advanced garbage collection algorithms 36-38
3.3.3 billing script engine heap manager 38-40
3.4 Summary 40-41
4 billing code compiler script engine 41-64
4.1 scripting language and compilation steps outlined 41-43
4.2 LUA5 bytecode instruction set 43-48
4.3 LEX and lexical analysis 48-51
4.4 YACC and parsing 51-54
4.5 grammar analysis and code generation 54-62
4.5.1 based register op 54-57
4.5.2 short Lu Buer computing 57-61
4.5.3 Lua instruction set for correction 61-62 <br / > 4.6 chapter Summary 62-64
5 billing scripting engine implementation and optimization basic processes 64-68
5.1 scripting engine running 64
5.2 billing system process improvement 64-67
5.2.1 compile phase 65
5.2.2 initialization phase 65
5.2.3 billing operational phase 65-67
5.3 summary 67-68
6 Full Summary 68-70
6.1 The main conclusions 68 - 69
6.2 Prospect 69-70
References 70-72
Thanks during 72-73
degree program has been published academic catalog 73-75
Related dissertations
- The Design of Script Interface Based on a Mobile2D Game Engine
- Research and Implementation of General Script Engine Based on Java Platform
- Research on Application Platform of Set Top Box Based on Script Language
- Design and Implementation of Mobile Phone Navigation System
- Porting & Tuning KVM in Power-Constrained Hand-Held Device
- Embedded JAVA virtual machine technology research
- Research and Implementation of Key Technologies for YHFT-Matrix Compiler Based on GCC
- The Design and Implementation of a Complier for SCADA Based on C
- Backend Porting for CSKY Based on LLVM Compiler Infrastructure
- Design and Implementation of Language LP for Log Parser
- Research and Implementation Based on the the J2ME Technology of Mobile Securities System
- Design and implementation of mobile phone software and network instant communication software
- The Design and Implementation of Phone Card Games Based on J2ME
- Design and Implementation of Electronic Meal Ordering System Based on J2ME
- The Design and Implementation of Vehicle Insurance System Based on Mobile Platform
- Asymmetric Dual-Space Collectors
- Establishment and Verification of the Timing and Power Consumption Model for the Embedded SRAM Compiler
- The Embedded SRAM Compiler Design and IP Verification
- Research and Design of Remote Intelligent Household Management System
- Research and Implementation on Protocol Adapter Based on the Dynamic Scripting Language of Lua