RMTool: Map File Format

RMTool: Map File Format


A map file consists of an ordered sequence of map entries. Each entry is placed within square brackets (and may span lines). A source model entity is mapped by the first line in the map it matches (this behaviour can be overridden in the command-line interface to the tools).

A map entry names entities in the source model and associates them with entities in the high-level model.

Source model entities are named by using the keywords specified in the current language setting. For example, if the default C language configuration is used, a software engineer may use the keywords directory, file, and/or function as in:

[ file=vm_fault\.c mapTo=KernelFaultHandler ]

specifies that all entities in the file vm_fault.c will be mapped to the high-level model entity KernelFaultHandler.

Regular expressions may be used when naming the source entities (but not when naming high-level model entities). The regular expression syntax is that of egrep.

By default, wildcards are places around the start and end of a source item regular expression. For instance, stating file=pager means file=.*pager.*. This wildcarding can be overridden through the use of the ^ and $ operators. For instance, file=^pager\.c$ states only the file named pager.c (and not pager.h).

Multiple high-level model entities may be named on the right hand side of a mapping entry. For example:

[ file=vm_fault\.c mapTo=KernelFaultHandler mapTo=AnotherEntity]

maps the entities in vm_fault.C to both KernelFaultHandler and AnotherEntity.

Lines beginning (in the first column) with # in the mapping file are considered comment lines. An example map file for the compiler example follows.

# .* in next line is unecessary
[ file=scanner.*               mapTo=Parse ]
[ file=buf\.[ch]               mapTo=Parse ]
[ class=Parser                 mapTo=Parse ]
[ class=Ast                    mapTo=AST   ]
[ class=AssignStmt             mapTo=AST   ]
[ class=BinOp                  mapTo=AST   ]
[ class=Block                  mapTo=AST   ]
[ directory=401 class=CallStmt mapTo=AST   ]

Back to RMTool: File Formats.

Last modified: June 28, 1996

Gail Murphy
murphy@cs.ubc.ca