next up previous contents
Next: 2.4.2.1 The Expansion of Up: Expansion of Macro COSY Previous: Introduction

Old Expander for Macro COSY Programs

Firstly, let's introduce the old expander.

Let MT, MNT stand for macro notation terminal symbols and macro notation non-terminal symbols respectively. Let tex2html_wrap_inline5863 denote the initial non-terminal of macro notation. Let tex2html_wrap_inline5865 mean that there exists a production of macro notation grammar (including context-sensitive constraints) which transforms a string x into a string y, where tex2html_wrap_inline5871 .

Define:

displaymath5827

where tex2html_wrap_inline5877 is a transitive closure of tex2html_wrap_inline5879 , i.e., tex2html_wrap_inline5881 (and tex2html_wrap_inline5883 respectively) means that there exists a production sequence of length one or more starting from x and resulting in y.

The elements of MPROGRAM are called macroprograms, the elements of MGEN are called macro expressions or macro generators.

Consider the following three mappings:

as
- a mapping which assigns some integers to range variables,
dec
- the mapping which gives a decimal representation of integer values,
val
- the mapping which computes the value of an integer expression without variables

The domains of as and val are some special kind of strings, while their co-domains are integer values, the domain of dec is the set of integers and the co-domain is the set of decimal representations, i.e., some kind of strings.

We now extend as and val to: tex2html_wrap_inline5909 and tex2html_wrap_inline5911 . Let tex2html_wrap_inline5913 denote the set of all integer expressions of our macro notation without range variables, i.e.,

displaymath5828

and let RVAR denote the set of all range variables, i.e.,

displaymath5829

Every tex2html_wrap_inline5917 can be represented as

displaymath5830

where tex2html_wrap_inline5919 , tex2html_wrap_inline5921 , tex2html_wrap_inline5923 and no substring of tex2html_wrap_inline5925 belongs to tex2html_wrap_inline5913 . We define:

displaymath5831

For example,

tex2html_wrap_inline5929 .

Similarly, every tex2html_wrap_inline5917 can be represented as

displaymath5832

where tex2html_wrap_inline5919 , tex2html_wrap_inline5935 , tex2html_wrap_inline5923 and no substring of tex2html_wrap_inline5925 belongs to RVAR. The context-sensitive restriction Irest1 guarantees uniqueness of the above representation. We define:

displaymath5833

In the sequel we shall use the symbol as to denote both as and tex2html_wrap_inline5947 , and val to denote both val and tex2html_wrap_inline5953 .

Throughout the following sections we will be representing macro programs schematically to facilitate the statement of definitions, theorems and their proofs. Capitalized names of basic or macro non-terminals will stand for the set of strings which may be generated from that non-terminal. Thus:

displaymath5834

The subscript ``0'' will indicate that all strings of the set contain no range variable. Thus:
tex2html_wrap_inline5957

tex2html_wrap_inline5959

To obtain the schematic representations of macro programs we now define:

displaymath5835

The complete expansion of a macro program mprog is given by expand(mprog), where the lower case names corresponding to the upper case names defined above represent arbitrary elements of the sets denoted by the corresponding upper case name. The function expand is defined as follows:

displaymath5836

An auxiliary mapping pathsfirst works in the following way. If a string x is a sequence of paths and processes, say tex2html_wrap_inline5971 , where tex2html_wrap_inline5973 , tex2html_wrap_inline5975 , tex2html_wrap_inline5977 are paths, tex2html_wrap_inline5979 are processes, then

displaymath5837

This means that it moves all paths before processes as required by the basic COSY grammar. If the string x is not a sequence of paths and processes then pathsfirst(x) is not defined.

For every string x, let tex2html_wrap_inline5987 , where y is a string and tex2html_wrap_inline5991 , denote the string obtained from x by replacing each occurrence of t by y. If x contains no t then tex2html_wrap_inline5987 equals to x.

To define exprepl and expdist let us first define the operator tex2html_wrap_inline6011 which transforms strings into strings, where j,k,m are parameters, j is the name (of an integer variable), k,m are integer values, x is an argument and x is a string from tex2html_wrap_inline6023 . The result of this operator is the following:

displaymath5838

For example:

displaymath5839

We need also two operators LSTRIP and FSTRIP which strip off the last and first separators of a given string respectively. We assume that tex2html_wrap_inline6029 , and for every tex2html_wrap_inline6031 and tex2html_wrap_inline6033 , let:

displaymath5840

displaymath5841

For instance:

displaymath5842




next up previous contents
Next: 2.4.2.1 The Expansion of Up: Expansion of Macro COSY Previous: Introduction

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