Tool Support for Language Design and Prototyping with Montages

نویسندگان

  • Matthias Anlauff
  • Philipp W. Kutter
  • Alfonso Pierantonio
چکیده

In this paper, we describe the tool Gem-Mex, supporting Montages, a visual formalism for the speci cation of (imperative/object oriented) programming languages. Introduction Montages [KP97] form a graphical notation for expressing the syntax and semantics of imperative and object oriented languages. Every syntactic construct has its meaning speci ed by a Montage, which consist of a diagram de ning graphically the control and data ow, and textually the semantic actions of the construct. The controlow edges show how behavior of the construct is composed from the behavior of its components, and dataow edges enable semantic actions to access the attributes of the construct's components. The Montages formalism is tuned towards ease of writability, readability, maintenance, and reuse of speci cations. The hope is that, like Wirth's `syntax diagrams', a graphical notation may help in making formal language descriptions more accessible to the everyday user. It does not compete with existing compiler construction techniques which are designed for the exible speci cation of e cient translations. The notation is supported by the Gem-Mex (Graphical Editor forMontages and Montages EXecutable generator) tool which guides the user through the process of designing and specifying a language. In other words, Gem-Mex forms a (meta) environment to enter and maintain the description of a language. In addition, it generates a specialized (programming) environment which allows to analyze, execute, and animate programs of the speci ed language. The language designer can use the generated environment as a semantics inspection tool to test and validate design decisions. Later the programmer can use the same environment for debugging programs. Further, in some situations the generated interpreter may be directly used as implementation of the language. Since language-documentation is based on the Montages descriptions, and the language-environment is deduced from this descriptions, it is guaranteed that design, documentation, debugging-support and implementation of the language are always consistent. Typically, in a realistic scenario many versions of a language will evolve over time and a tool like Gem-Mex is useful to maintain them in a 1 The tool runs on Unix platforms and Windows NT; it is freely available at http://www.tik.ee.ethz.ch/ montages consistent way. The tool is currently used by di erent groups for both the speci cation of general purpose programming languages (Pascal, Java, Smalltalk) and the design of domain speci c languages [KST98]. The Montages Formalism consist of three parts 1. A canonical de nition of abstract syntax trees (ASTs) from EBNF rules. 2. A simple attribution mechanism for these ASTs: { decoration of ASTs with guarded controlow edges, { decoration the ASTs with data access-arrows (reversed dataow arrows), { decoration the ASTs with dynamic-semantics-actions. The attribution rules are given by means of a formal visual language. The visual language relies heavily on the common intuition existing for the graphical notations control/data ow graphs, nite state machines, and ow charts. 3. A computational model based on the control/data ow graphs which result from the attribution process. The attribution mechanism is based on standard techniques like attribute grammars [WG84] and graph grammars [REK97]. The dynamic semantic actions are given with Abstract State Machine (ASM) rules [Gur95]. ASMs are a state-based formalism in which a state is updated in discrete time steps. Unlike most state-based system, the state is given by an algebra, that is, a collection of functions and a set of objects. Both functions and sets may change their de nitions by means of state transitions which are red repeatedly. ASMs have been already used to give the dynamic semantics of full-scaled programming languages (e.g. C, Occam, Java; see [BH98] for a commented bibliography) as well as for the systematic development of provably correct compilers [ZG97]. The computational model based on the control/data ow graphs is formalized with an ASM. In this model control ows through the graph, enabling the semantic actions attributed to the nodes. These actions use the data arrows to access attributes of other nodes, and rede ne local attributes. To summarize, a language speci cation consists of a collection of Montages, each specifying the meaning of one syntactic construct in the language. Such a Montage consists of subparts, containing the EBNF rule, the control and data ow attributions, the static semantics condition, and the dynamic semantics action. We show the Relation and the While Montage in Fig. 1. The dotted arrows de ne the control ow, the symbol I denotes the point where control enters from outside, and the T denotes the point where control exits. As expected the Relation Montage has a control ow, that rst goes through the two subexpressions, which are depicted with boxes. Then the control ow enters the oval, denoting a semantic action, which is given in the last subpart of the Montage. Finally the control leaves through the T, without any branches. In contrast, the control ow of the While Montage contains a cycle. Whether to cycle or to leave the construct is dependent on the guard which is given as the Fig. 1. Montages examples label of the control arrow from the Expression to the StatementSequence. The condition part contains the context sensitive constrains formulated as a rstorder logic predicate, e.g. in the Relation Montage the condition states that the types of the Expressions must be compatible. The staticType attribute holds the type of the expression evaluated during the static analysis. Tool Architecture In the introduction we sketched how the user is guided by Gem-Mex through the process of designing and specifying a language using Montages. Fig. 1 shows part of the user interface. The buttons in the rst line are used to: save, open a Montage, generate html and tex output, delete, and exit. The buttons in the second line allow to choose speci c graphical elements during the editing process of a Montage: boxes for simple components, ovals for semantic actions, special list boxes, additional textual attribution rules. As an example of the generated environment we see in Fig. 2 the user interface of the debugger. On the left side an example program of the speci ed language is shown. The arrow animates the ow of control through the program text. On the right side, attributes of the construct currently under execution are listed, and by clicking on them their value can inspected. Fig. 3 illustrates the architecture of the tool. The implementation of Gem-Mex is based on Lex/Yacc, C, and Tcl/Tk. The core is a speci cally developed ASM to C compiler called Aslan [Anl98] (ASM Language). Aslan provides support for structuring ASMs in an object oriented way. Gem-Mex generates for each Montage the ASM semantic in form of an Aslan class. Then this classes are compiled and executed.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Montages/Gem-Mex: A Meta Visual Programming Generator

Last decade witnessed a disappointing lack in technology transfer from formal semantics to language design. Research in formal semantics has developed increasingly complex concepts and notation, at the expense of calculational clarity and applicability in the development of languages. Montages is a visual domain-speciic formalism for specifying all the aspects of a programming language. It is i...

متن کامل

Domain Specific Languages in Software Architecture

Building a software product requires knowledge in both software engineering and the domain the software is written for. However, common software engineering methods in fact exclude domain experts from the architectural design of a software system, because the generality of the notations defined by these methods require expert knowledge in the field of software engineering and especially softwar...

متن کامل

Domain Speci c Languages in Software

Building a software product requires knowledge in both software engineering and the domain the software is written for. However, common software engineering methods in fact exclude domain experts from the design phase of the software development, because the generality of the notations deened by these methods requires expert knowledge in the eld of software engineering. In order to avoid this e...

متن کامل

Formal Aspects of and Development Environments for Montages

The specification of all aspects of a programming language requires adequate formal models and tool support. Montages specifications combine graphical and textual elements to yield language descriptions similar in structure, length, and complexity to those in common language manuals, but with a formal semantics. A broad range of people involved in programming language design and use may find it...

متن کامل

Tool Support for Design by Contract

Numerous experience reports indicate that prototyping is a serious and successful development strategy. We believe that it is not sufficient to provide graphical notations for object-oriented analysis, but that the notation of contracts in conjunction with prototyping, i.e., building executable models, is the proper technique for mastering complexity and gaining insights into a problem domain. ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1999