ECLiPSe**specific transformation processes expressions and introduces local**
variables if needed, as shown on Figure 5 with Vi **variables and** nth **predicate**
calls.

## 5 Handling Cp Languages And Transformation Chains

In this section, we describe the whole transformation chain from a given CP
language to another language.

## 5.1 Parsing Cp Languages

The front-end of our system parses a source CP language file to get a model representation (on which transformation rules act) matching the concepts of the CP
language (injection phase). The back-end generates the code in the target CP
language (extraction phase) from the model representation. Interfacing CP languages and metamodels is implemented by means of the TCS tool [11]. This tool allows one to smoothly associate grammars and metamodels. It is responsible for generating parsers of CP languages and also code generators.

Figure 10 depicts an extract of the TCS file for s-COMMA**. In a TCS file**
every concrete concept must have a corresponding template **to be matched. For**
instance, the SCMAClass **template implements the grammar pattern for class declarations using at the same time features of this concept defined in the metamodel of** s-COMMA**. At parsing time on the** s-COMMA **social golfers example**
(see Figure 4, the "class" **token is matched for the week class statement. Then** Week **is processed as the** name **attribute (a string in the metamodel) of a new**
class instance. Then the "{" **token is recognized and the class features (the array of groups and the constraint) are processed by implicit matchings to their** corresponding templates using the features reference. Finally the "}" **token terminates the pattern description. In the** SCMAClass **template (lines 4 to 8), several**
TCS keywords are used. Here is a description of the most important **keywords** use in Figure 10:

- context **defines a local symbol table.**
- addToContext **adds instances to the current symbol table.** - refersTo **accesses to the symbol tables according to the given parameter (here**
the name) to check the existence of an already declared element.

## 5.2 Model Checking Rules

The presented metamodels (see section 2) and the previous subsection show how to get CP language models. However, many irrelevant or erroneous **models can** be obtained without any additional checking [2]. For instance, variables may be defined with empty domains or expressions may be ill made (e.g. several equalities in an equality constraint).