Home

 

Getting Started with Elisa

Using EDS

Demo's

Tutorials

 

Language Description

1. Lexical Elements
2. Basic Data Types and Expressions
3. Definitions
4. Streams
5. Backtracking
6. Statements and Special Expressions
7. Arrays
8. Lists
9. Descriptors
10. Components
11. Collections
12. Generic Components
13. Terms
14. Categories
15. Types 

16. Built-in Definitions
17. Higher-order Definitions

18. External Interfaces

Index

Data Structures

1. Sequences
2. Examples involving Lists
3. Trees
4. Graphs
5. Searching State Spaces
6. Language Processing
7. Knowledge Representations          

 

Metaprogramming

1. Introduction
2. What are Domain Definitions?

3.  Sorts of Domain Definitions

4.  Manipulations of Domain Definitions

5.  Translating Domain Definitions

6.  Dialogue Sessions

7.  Example of Concentric Circles

8.  Example of Domain Substitution applied to Concentric Circles

9.  Example of an Order Processing Application

10.Example of an Airport Information System

11.Example of a Rental Boat Business

12.Benefits of Domain Definitions

   

Back Home Up Next


5. Translating Domain Definitions

 

The metaprocessor is a key component of the metaprocessing system. It has as input a set of related domain definitions. The output is a skeleton of a source program. Our current implementation generates a skeleton of an Elisa program. To demonstrate the process of metaprocessing we return to our Family program and formulate a complete set of domain definitions. See Figure 1.


Family        = Father + Mother + Children;

Father        = Person;

Mother       = Person;

Children     = collection (Person);

Person         = Name + BirthDate + Gender;

Name           = text;

BirthDate   = Date;

Gender       = enum (Male, Female);

Date            = text;

text             = predefined;


Figure 1: Domain definitions of the Family

Based on these domain definitions the metaprocessor generates the following skeleton Elisa source code (Figure 2).


<< BEGIN OF INPUT 
Family = Father + Mother + Children;
Father = Person;
Mother = Person;
Children = collection(Person);
Person = Name + BirthDate + Gender;
Name = text;
BirthDate = Date;
Gender = enum(Male, Female);
Date = text;
text = predefined;
END OF INPUT >> 

component Familys; 
 type Family; 
      newFamily(Father, Mother, Children) -> Family; 
      getFather(Family) -> Father; 
      getMother(Family) -> Mother; 
      getChildren(Family) -> Children; 
      setFather(Family, Father) -> nothing; 
      setMother(Family, Mother) -> nothing; 
      setChildren(Family, Children) -> nothing; 
begin
      newFamily(Father, Mother, Children) = Family:[Father; Mother; Children]; 
      getFather(aFamily) = aFamily.Father; 
      getMother(aFamily) = aFamily.Mother; 
      getChildren(aFamily) = aFamily.Children; 
      setFather(aFamily, aFather) = [ aFamily.Father:= aFather];
      setMother(aFamily, aMother) = [ aFamily.Mother:= aMother];
      setChildren(aFamily, aChildren) = [ aFamily.Children:= aChildren];
end component Familys; 

type Father = Person; 

type Mother = Person; 

type Children = list(Person); 

component Persons; 
 type Person; 
      newPerson(Name, BirthDate, Gender) -> Person; 
      getName(Person) -> Name; 
      getBirthDate(Person) -> BirthDate; 
      getGender(Person) -> Gender; 
      setName(Person, Name) -> nothing; 
      setBirthDate(Person, BirthDate) -> nothing; 
      setGender(Person, Gender) -> nothing; 
begin
      newPerson(Name, BirthDate, Gender) = Person:[Name; BirthDate; Gender]; 
      getName(aPerson) = aPerson.Name; 
      getBirthDate(aPerson) = aPerson.BirthDate; 
      getGender(aPerson) = aPerson.Gender; 
      setName(aPerson, aName) = [ aPerson.Name:= aName];
      setBirthDate(aPerson, aBirthDate) = [ aPerson.BirthDate:= aBirthDate];
      setGender(aPerson, aGender) = [ aPerson.Gender:= aGender];
end component Persons; 

type Name = text; 

type BirthDate = Date; 

type Gender = (Male, Female); 

type Date = text; 


Figure 2: Skeleton of the Family

 The metaprocessor generates, depending on its input a number of Elisa components and type declarations.

In Elisa, a software component is a self-contained building block.  It has a well-defined interface with its outside world. A software component is designed to perform a number of related functions. It consists of two parts:

1. The interface-section. It contains the signatures of the operations and functions that may be called from outside the component. Additionally, it may also contain type-specifications.

2. The implementation-section. It contains the definitions of the operations and functions that are externally accessible as specified in the interface-section. It may also contain other definitions that are local to the component.

The metaprocessor generates three kinds of functions: the new functions create new so-called descriptors. A descriptor is a data structure that describes a certain type. For example, the newFamily function generates a new family descriptor. The newPerson function creates a new Person descriptor. A get function retrieves an element of the specified descriptor, and a set function changes an element of the specified descriptor.  

Back Home Up Next

  Part 6: Metaprogramming   Translating Domain Definitions

            
Introduction

Home | Highlights of Elisa | Integrating Different Paradigms | Getting Started with Elisa | Demo's  | What is Domain Orientation | Bibliography | Copyright | News | Contact | Contents

Language Description:

Lexical Elements | Basic Data Types and Expressions | Definitions | Streams | Backtracking | Statements and Special Expressions | Arrays | Lists | Descriptors | Components | Collections | Generic Components | Terms | Categories | Types | Built-in Definitions | Higher-order Definitions | External Interfaces | Index 

Data Structures: Sequences | Examples involving Lists | Trees | Graphs | Searching State Spaces | Language Processing | Knowledge Representations
Domain Modeling:

Domain Modeling | Concepts | Domain Definitions | Domain Operations | Domain Implementations | Systems | Case study: an Order processing system | Case study: an Airport Support system | Domain Orientation versus Object Orientation

Design Patterns:

Introduction | Abstract Factory | Builder | Factory Method | Prototype | Singleton | Adapter | Bridge | Composite | Decorator | Facade | Flyweight | Proxy | Chain of Responsibility | Command | Interpreter | Iterator | Mediator | Memento | Observer | State | Strategy | Template Method | Visitor 

 

click tracking

This page was last modified on 19-05-2015 12:17:09   

free hit counter