Browse Prior Art Database

Argument Bindings and Macro Evaluation in XDE

IP.com Disclosure Number: IPCOM000034572D
Original Publication Date: 1989-Mar-01
Included in the Prior Art Database: 2005-Jan-27
Document File: 2 page(s) / 14K

Publishing Venue

IBM

Related People

Gest, SB: AUTHOR [+2]

Abstract

XDE is an advanced software development environment targeted for the IBM RT PC* running IBM's proprietary UNIX** operating system AIX***. This paper will describe three aspects of macro expansion in the XDE command language which together combine to make a unique and powerful facility. The three aspects are: 1) argument binding at parse time, 2) the recursive evaluation of a script which may in turn cause further recursive evaluation, and 3) the macro rescan facility as part of the normal evaluation algorithm. Most macro processors do argument substitution by simple textual replacement at the time the macro is expanded. XDE's macro argument binding is done at parse time by pruning and replacing sub-parse trees. A distinction is made between a macro and a script.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 2

Argument Bindings and Macro Evaluation in XDE

XDE is an advanced software development environment targeted for the IBM RT PC* running IBM's proprietary UNIX** operating system AIX***. This paper will describe three aspects of macro expansion in the XDE command language which together combine to make a unique and powerful facility. The three aspects are: 1) argument binding at parse time, 2) the recursive evaluation of a script which may in turn cause further recursive evaluation, and 3) the macro rescan facility as part of the normal evaluation algorithm. Most macro processors do argument substitution by simple textual replacement at the time the macro is expanded. XDE's macro argument binding is done at parse time by pruning and replacing sub-parse trees. A distinction is made between a macro and a script. A script is a text file which contains XDE environment commands and control sequences. A macro is a variable, either one within the application or one outside the domain of the application pertaining to the XDE environment, whose value is a string containing XDE commands and control sequences. This is the only difference between scripts and macros. They are otherwise syntactically and semantically equivalent. Another aspect of this type of macro evaluation is that the macro is not rescanned after expansion as in most macro processors. Rescanning is done in most macro processors to check for and expand nested macros. In XDE, the rescanning is done as a normal part of command evaluation; thus, no additional algorithmic effort is required to rescan the expanded macro. When a command string is evaluated, the string is parsed, and the resulting parse tree is then interpreted. The parser generates the following tree for a simple command with one argument (using lisp-like syntax): cmd_unit( command( <command_name> <arg_expression> )) During the interpretation phase of evaluation, the command dispatcher determines whether 'fac' is a built-in command, macro or stride script. If 'fac' is a script, a buffer is allocated and the contents of the file are read into it. From this point on, macros and scripts are processed in the same way. An argument substitution indicator in a macro or script is simply an '@' followed by a number. The number represents the argument position. Thus, '@3' would indicate the third argument. When the scanner encounters a token of the form '@<number>', the scanner returns the number as the value of the token and indicates to the parser that the token type is 'argument'. When the parser reduces the 'argument' to a nonterminal, the action which takes place is as follows: 1) Find the argument tree on the invoking parse tree.

2) Copy the tree indicated by the argument number.

3) Replace the formal argument indicator with the copy

of the

argument tree of the invoking command. For example, during the eval...