next up previous contents
Next: Prerequisites Up: SML Implementation of Previous: List of Figures

Introduction

In this project, we have created a system using Standard ML (SML) to implement the new Macro COSY notation. The system is run on the SUN workstation under the UNIX operating system. Figure 1.1 shows the structure of the system. From Figure 1.1 we can see that the system will input the COSY program which is represented as a string and pass it to the lexical analyzer. The lexical analyzer will do the analysis and change the string into a token list. After completed analysis, if errors are found, the lexical analyzer will output a failure message. Otherwise, it will pass a token list to the parser. When the parser receives the token list, it will use this token list to construct a syntax tree according to the Macro COSY grammar. If errors are found during parsing, the parser will output a failure message. Otherwise, it will pass the syntax tree to the context-sensitive restrictions checker. This checker will check whether the syntax tree satisfies all context-sensitive restrictions. If one of the restrictions is not satisfied, the checker will display some messages and indicate where the COSY program is incorrect. Otherwise, the checker will pass a syntax tree which satisfies all context-sensitive restrictions to the expander. Before expanding the macro program, the system will move all paths to the front of processes and change all distributor subtrees into concatenator subtrees. After that, the expander will expand the syntax tree into the other type of syntax tree which is in the form of a Basic COSY program. We can use the displayer to display the expanded Macro COSY program on the screen. We also can re-process the expanded Macro COSY program again. This will check whether the expanded Macro COSY program is expanded correctly. After re-processing, if no error is found and the output is the same as the expanded Macro COSY program before re-processing, the expansion is correct. Otherwise, the expansion is incorrect.

figure592

Before creating this system, there were some other problems which needed to be dealt with first:

1.
We needed to understand what COSY is, how to use SML and what the expander should do. To give the readers of this paper similar background, we have included sections 2.3 and 2.4, which are sections 2.1 and 3.3 from the book ``Specification and Analysis of Concurrent Systems - The COSY Approach'' by Dr. Ryszard Janicki and Dr. Peter E. Lauer(Copyright permission granted by Springer-Verlag, please see Appendix D). But some correction had to made to the originals for human errors caught in the process of implementation.

2.
We needed to convert the Macro COSY expansion from string to tree orientation.

3.
We needed to code the new system in SML.

In Chapter 2, after a brief introduction of a functional programming language SML, COSY and the expansion of macro COSY programs, we discuss them in details. In section 2.2, we discuss the functional programming language - Standard ML. In section 2.3, we dicsuss Basic COSY and Macro COSY which are from the book [JL92]pp.19-20 and pp.231-256. In section 2.4, we discuss the old expander for the Macro COSY program which is from the book [JL92]p.256-267. It expands the Macro COSY program from a string into a basic program which is a string as well. In this section, we also introduce a new expander for the Macro COSY program which we have designed. The new expander expands the Macro COSY program from a tree into a tree. In chapter 3, we mainly discuss how to use the SML module facilities to code the new system. In section 3.2, we discuss all signatures of the new system. In section 3.3, we discuss all functors of the new system. In section 3.4, we declare structures(combine all modules) in order to build the new system. In section 3.5, we discuss how to use the new system.


next up previous contents
Next: Prerequisites Up: SML Implementation of Previous: List of Figures

Peter Lauer
Mon Jul 22 17:29:46 EDT 1996