# The GRS file format

In Grew, rewriting rules are described in a GRS file (GRS stands for Graph Rewriting System).

A GRS file describes a set of modules, each module contains a set of rules.

Files using this format are expected to used the .grs file extension.

## Grew GRS

A Grew Graph Rewriting System (GRS) is defined by:

• the definition of feature domain introduced buy the keyword features
• the definition of label domain introduced buy the keyword labels
• a set of modules (each module is introduced by the keyword module)
• the definition of sequences (keyword sequences)

## Feature domain

In graphs and in rules, nodes contain feature structures. To control these feature structures, a feature domain must be given first. In the feature domain declaration, feature names are identifiers and are defined as:

• closed feature accepts only an explicit given set of possible values (like the cat feature value below);
• open feature name accepts any string value (like the lemma feature value below);
• integer feature (like the position feature below).

In closed feature definition, feature values can be any strings; double quotes are required for string that are not lexical identifier (like values for pers).

features {
mood: inf, ind, subj, pastp, presp;
lemma: *;
phon: *;
pers: "1","2","3";
position: #;
}

REM: values of pers feature are integers but the only way to restrict to the finite domain {1, 2, 3} is to declare it as a closed feature and possible values as strings.

## Label domain

An explicit set of valid labels for edges must be given after the labels keyword.

By default, edges are drawn with a black solid line and above the figure in DEP representation.

To modify the color or the position of the edges, the user can add attributes to a label with suffixes:

• @bottom to put the label above
• @red, @blue, … to modify the color of the link and the label
• @dot or @dash to modify the style of the link

Several suffixes can be used simultaneously.

labels { OBJ, SUBJ, DE_OBJ, ANT, ANT_REL@red, ANT_REP@blue@bottom@dash }

## Module

In Grew, rules are grouped in modules. A module is defined by a name and a set of rules. Syntax of rules is defined in Grew basic rules, Lexical rules and Filter rules.

Example of module:

module det {

rule det_1 {
...
}

rule det_2 {
...
}

}

A module can be declared as confluent with the confluent keyword syntax:

module confluent mod_name { ... }

WARNING Grew does not check that the module is confluent. If a module is declared confluent, then only one normal form is computed. If a non-confluent module is declared confluent, some normal forms may be lost!

## Sequences

In the sequences part of a GRS file, each sequence is described by a name and a list of modules. The same module can be used in several sequences but it can also be used several times in the same sequence (mainly useful when total ordering of module is not possible).

# Examples

A minimal GRS file (without any module) looks like:

features {
cat: v, np;
phon: *;
lemma: *;
}

labels { suj, obj }

sequences { dummy {} }

A bigger grs file:

features { ... }

labels { OBJ, SUBJ, DE_OBJ, ANT }

module det {

rule det_1 {
...
}

rule det_2 {
...
}
}

...

module ana {
...
}

sequences {
full {det; normsyn; arg; ana}
dn {det; normsyn}
}

## Split a GRS description into several files

It is possible to put a list of modules in a external file modules_1_and_2.grs:

modules_1_and_2.grs
module M1 { ... }

module M2 { ... }

and to include them in a GRS file with the syntax below:

include "modules_1_and_2.grs";

It is possible to use recursively the include directive.