Abstract

Context: This paper presents the concept of open programming language interpreters and the implementation of a framework-level metaobject protocol (MOP) to support them. Inquiry: We address the problem of dynamic interpreter adaptation to tailor the interpreter's behavior on the task to be solved and to introduce new features to fulfill unforeseen requirements. Many languages provide a MOP that to some degree supports reflection. However, MOPs are typically language-specific, their reflective functionality is often restricted, and the adaptation and application logic are often mixed which hardens the understanding and maintenance of the source code. Our system overcomes these limitations. Approach: We designed and implemented a system to support open programming language interpreters. The prototype implementation is integrated in the Neverlang framework. The system exposes the structure, behavior and the runtime state of any Neverlang-based interpreter with the ability to modify it. Knowledge: Our system provides a complete control over interpreter's structure, behavior and its runtime state. The approach is applicable to every Neverlang-based interpreter. Adaptation code can potentially be reused across different language implementations. Grounding: Having a prototype implementation we focused on feasibility evaluation. The paper shows that our approach well addresses problems commonly found in the research literature. We have a demonstrative video and examples that illustrate our approach on dynamic software adaptation, aspect-oriented programming, debugging and context-aware interpreters. Importance: To our knowledge, our paper presents the first reflective approach targeting a general framework for language development. Our system provides full reflective support for free to any Neverlang-based interpreter. We are not aware of any prior application of open implementations to programming language interpreters in the sense defined in this paper. Rather than substituting other approaches, we believe our system can be used as a complementary technique in situations where other approaches present serious limitations.

Highlights

  • Introduction and MotivationsInformation hiding, as discussed by Parnas in [ ], is a software design principle according to which a software component should expose its services through an interface, but hide its implementation details

  • In this paper we introduce the concept of open interpreters and we describe their prototype implementation integrated in Neverlang, a framework for modular development of programming languages

  • In this paper we provide the definition of open interpreters, we describe a model to support them and we implement a prototype for the Neverlang framework

Read more

Summary

Introduction and Motivations

Information hiding, as discussed by Parnas in [ ], is a software design principle according to which a software component should expose its services through an interface, but hide its implementation details. Listing shows an agent whose register method would register the agent at the before hook of all nodes involved in the addition operation (for simplicity, the code for RMI connection to the interpreter is omitted.) This is done by defining a tree pattern in terms of grammar productions and/or nonterminals to identify the relative tree nodes. An agent might want to introspect and/or modify the interpreter irrespectively of the execution control flow, for example, in order to change the language specification. The semantic action related to the production labeled Add uses the HashMapInstance class, defined in package neverlangJS.util, to instantiate objects that will store fields in a Java HashMap. Notice that $New[1].name refers to the attribute name provided by the PrototypeName nonterminal and stores the name of the prototype to be instantiated. In Neverlang.JS, the symbol table is a subclass of a Java HashMap, we use the HashMap’s replaceAll method to update all references

Related Work
Conclusions
B Demonstrative Examples
Dynamic Adaptation
General Applicability

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.