1、A. T. Kookier January 2004IntroductionThe Asf+Sdf Meta-Environment are an interactive development environment with a graphical user interface written in JFC/Swing. A typical session in this environment results in an overwhelming amount of windows presenting the Meta-Environment itself next to lots o
2、f editors all trying to catch the attention of the user. Although the described scene is a little bit exaggerated the several open windows and JFC/Swing graphical user interface were the reasons to take a look into Eclipse.Eclipse is a framework for creating programming environments, wherefore curre
3、ntly versions are available for C / C+, java and cobol. Each version addresses a specific programming language with its own set of tools, commands and screen layout. Because Eclipse is a well developed environment the Asf+Sdf Meta-Environment could benefit from integration with Eclipse. Eclipse offe
4、rs the possibility to make your own perspective (which is a screen layout) consisting of tree views, editors and other kind of views all in one place.Eclipses on the other side can benefit from the integration with the Meta- Environment ,because the Meta-Environment brings generic language technolog
5、y to Eclipse. Instead of developing a development environment for each programming language one development environment for the Meta-Environment is enough to provide tools for every programming language developed in the Meta-Environment.Eclipse is an open source framework for creating programming en
6、vironments. Currently versions exist for C / C+1, java and Cobol2. New tools and languages can be added by writing java applications that perform parsing, type checking and the like for a new language. Eclipse provides a rich set of tools oriented toward user-interface construction and java compilat
7、ion. The level of automation for building environments for new languages is, however, low.The Asf+Sdf Meta-Environment are a programming environments generator: given a language definition consisting of a syntax definition (grammar) and tool descriptions (using rewrite rules) a language specific env
8、ironment is generated. A language definition typically includes such features as pretty printing, type checking, analysis, transformation and execution of programs in the target language. The Asf+Sdf Meta-Environment are used to create tools for domain-specific languages and for the analysis and tra
9、nsformation of software systems. As the Eclipse and Meta-Environment technologies are to a large extent complementary, it is worthwhile to investigate how they can be integrated.Eclipse Plugin TechnologyThe Eclipse Platform is designed for building integrated development environments .An IDE can be
10、built by providing the Eclipse Platform with a plugin contributing to an extension point of some other plugin. In fact the Eclipse Platform is a number of plug-in itself. It consists of a small kernel which starts all necessary plug-in to run a basic instance of the Eclipse Platform. All other funct
11、ionality is located in plug-in which extend these basic plug-in. In this way Eclipse provides tool providers with a mechanism that leads to seamlessly integrated tools. Eclipses plugin are written in java and consist of a manifest file and java classes in a JAR archive. The manifest file declares th
12、e extension points of the plugin and which other plugin it extends. On start-up the Eclipse Platform discovers which plug-in are available and it generates a plug-in registry. The plug-in itself is loaded when it actually needs to be run.Meta-Environment Technology The Asf+Sdf formalism is used for
13、the definition of syntactic as well as semantic aspects of a language. It can be used for the definition of a range of languages (for programming, writing specifications, querying databases, text processing, or other applications). In addition it can be used for the formal specification of a wide va
14、riety of problems. Asf+Sdf can be characterized as a modular, rewriting-based, specification formalism in which syntax and semantics are completely integrated.The Asf+Sdf Meta-Environment is both a programming environment for Asf+Sdf specifications and a programming environment generator which uses
15、an Asf+Sdf specification for some (programming) language L to generate a stand-alone environment for L. The design of the Meta-Environment is based on openness, reuse, and extensibility. The Meta-Environment offers syntax-directed editing of Asf+Sdf specifications as well as compilation of Asf+Sdf s
16、pecifications into dedicated interactive stand-alone environments containing various tools such as a parser, unparser, syntax-directed editor, debugger, and interpreter or compiler.Figure1 shows the user interface developed using JFC/Swing. This figure shows the modular structure of the specificatio
17、n. Each node in the graph can be clicked and allows the invocation of a syntax, equation, or term editor.The various types of editors are decorated with different pull-down menus. All editors have functionality to invoke the parser, view the parse tree of the focus as graph, and to move the focus. T
18、erm editors may have language specific pull-down menus.In order to achieve a strict separation between coordination and computation we use the ToolBus coordination architecture, a programmable software bus based on process algebra. Coordination is expressed by a formal description of the cooperation
19、 protocol between components while computation is expressed in components that may be written in any language. We thus obtain interoperability of heterogeneous components in a (possibly) distributed system. The components are not allowed to communicate directly with each other, but only via the Tool
20、Bus . This leads to a rigorous separation of concerns.Architectural considerationsThe Meta-Environment consists of about 20 cooperating components, including a parse table generator, a parser and unparser, a term store (for caching results), and an interpreter and compiler. Also, a graphical user in
21、terface and a number of text editors (such as GNU Emacs3 and Vim4) as well as a structure editor are connected to the Meta-Environment. These allow user interaction with the system, and in particular allow users to edit syntax, equations and terms.Figure2 is a (simplified) view showing these compone
22、nts connected to the ToolBus Current architecture: using JFC/Swing and external editors. Figure 2 shows the current implementation with separate components for the GUI and the various text editors. Currently, the GUI is implemented in JFC/Swing. Each time a text editing session is requested by the u
23、ser, a new instance of one of the supported system editors is executed to take care of the editing session. These text editors need only implement a minimal interface to be usable by the Meta-Environment. Some form of operating system level communication channel is needed (e.g. socket, pipe). The ed
24、itor then needs to be able to receive and execute commands to add a menu to the menu-bar, set the cursor at a specific location, and highlight or select a region of text.Target architecture: using Eclipse for both GUI and editors. Eclipse exports many GUI features that can be used to write plug-in a
25、nd also has a built-in editor which implements the required Meta-Environment text editor interface. From an Eclipse point of view, it is interesting to be able to reuse the generic language technology offered by the Meta-Environment. From the Meta-Environment point of view, it would be interesting t
26、o see if Eclipse could be used to implement the GUI and the text editors (the dotted rectangle in Figure 2). From a ToolBus point of view, it is interesting to see how a single tool (Eclipse in this case) can serve as the implementation of multiple components (both GUI and text editor).Implementatio
27、n We describe some of the implementation details of the current Meta-Environment GUI .In the target architecture we replace both the JFC/Swing GUI and the external text editors by Eclipse as described.JFC/Swing-based implementationThe ToolBus principle to separate functionality leads to a generic im
28、plementation of the user interface. To meet the Meta-Environment requirements the user interface only has to implement some basic functionality. The JFC/Swing implementation extends the Meta-Environment with a GUI that supports several components: a tree panel, graph panel, and some informational pa
29、nels. The tree and graph panels provide the user with a representation of opened and imported modules in a textual and graphical way, respectively. Status messages and information about selected modules are displayed in dedicated informational panels. Each of these GUI elements is dumb: it is capabl
30、e of presenting a graphical representation of its data and it communicates events (e.g. a mouse click) to the ToolBus, but it abstracts from the details of these events. The actual implementation of an event (e.g. performing a refactoring operation on a selected module) is handled elsewhere in the M
31、eta-Environment.The provided basic framework can be extended dynamically with user interface elements by means of ToolBus messages sent to the user interface. These messages contain the type of user interface element to be added (e.g. menu, tool-bar button), the caption to be displayed, and the acti
32、on that has to be performed when selecting this user interface element. This setup ensures that the user interface does not know about any functionality implemented in the Meta-EnvironmentText editing functionality is provided by means of external text editors as described before. In general the choice of text editor is free as long as it is capable of adding menus and methods for displaying a focus. After connection with the ToolBus is established it will receive its specific menus, menu items, and corresponding actions.Eclipse-based implementationIn
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1