首页 | 本学科首页   官方微博 | 高级检索  
     


Virtual machine framework for constructing domain-specific languages
Abstract:An object-oriented framework is proposed for constructing a virtualmachine (VM) to be used in the context of incrementally and iteratively developing a domain-specific language (DSL).The framework iswritten in C#. It includes abstract instruction and environment classes. By extending these, a concrete layer of classes is obtained whose instances define the semantics of a set of instructions, as well as one or more execution environment instances that can be manipulated by the instructions. The framework provides a generic mechanism for reading a set of instructions, executing them sequentially by default but branching if necessary, storing or retrieving internal variables, and accessing and manipulating the environment as per the instructions. In general, each instruction can execute an arbitrary C# method as specified by the developer. The syntactic form of instructions is limited to five possibilities. Using the framework, a range of VMs can be generated, each tailored to support a developerdesigned target-level DSL. Since each such language is built in terms of these five instruction formats, these targetlevel languages share a common syntactic structure. The result is a platform to support an incremental iterative language design and implementation approach that involves the following three phases: determine a set of targetlevel instructions with semantics appropriate to the specific domain; determine source-level language instructions whose syntax appeals to the domain specialist and provide a simple compiler to map the source to target instructions. The first two phases are relatively disjoint and importantly separate syntax concerns from semantics concerns. The final phase is quite straightforward. Comparative performance results support the use of the framework as an alternative to using an interpreter or hardcoded VM for DSL development.
Keywords:
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号