Universität Paderborn - Home Universität Paderborn
Die Universität der Informationsgesellschaft

Generating Software from Specifications WS 2013/14 - File Streams.fw

@=~
~p maximum_input_line_length = infinity

This file specifies a little domain-specific language, which
allows to compose streams from declared components.

A Streams program consists of a sequence of definitions 
followed by a sequence of streams. 
Each definition introduces entities of one of three kinds:
sources, sinks, and connectors. 
Each entity is bound to a name, and is defined to have a certain capacity
given by a non-negative number.
The name of the entities have to be pairwise different.

A stream in the second part of the program consists of a 
source and a sink, connected by a sequence of connectors.
The source shall run on its full capacity. 
Hence, the capacity of the sink and of any connector in that stream
must be at least as great as the capacity of the source of that
stream.

Here is an example for a correct Streams program:
~O~<Streams.ok~>~{~-
source: a 10, b 5;
sink: x 20, y 5;
connector: k 7, h 9, f 15, g 3;
a -> f -> x;
b -> h -> h -> k -> y;
b -> x;
~}

Here is an example for an erroneous Streams program:
~O~<Streams.err~>~{~-
source: a 10, b 5;
sink: x 20, y 5, z 1; /* z is multiply defined */
connector: k 7, h 9, f 15, g 3; 
connector: z 5; /* z is multiply defined */
a -> q -> x; 	/* q is undefined */
d -> h -> x; 	/* d is undefined */
a -> k -> x; 	/* k has too little capacity */
a -> y; 	/* y has too little capacity */
y -> x;	  	/* y must be a source */
b -> h -> a;	/* a must be a sink */
b -> a -> x;	/* a must be a connector */
~}

The concrete syntax is to be specified in the following macro.
Complete the productions for the program structure and the
definitions.
The syntax for a single stream is given, because it is crucial to
not to cause parser conflicts by different nonterminals for the 
roles of identifiers.
~O~<Streams.con~>~{

Stream:		Source Tail.
Tail:		Connector Tail / '->' Sink ';'.
Connector:	'->' Ident.
Source:		Ident.
Sink:		Ident.
~}

The non-literal token specifications:
~O~<Streams.gla~>~{

~}

Algol-like scope rules are specified for this language:
~O~<NameAnalysis.specs~>~{

~}

The module roles for defining and applied identifiers are used
in the standard way. 
~O~<StreamsName.lido~>~{

~}

The following property is used to detect multiple definitions:
~O~<StreamsMult.pdl~>~{~-

~}

The property Defs is used to detect and report multiple definitions:
~O~<StreamsMult.lido~>~{

~}

Specify a property to distinguish and check the kinds of entities:
~O~<StreamsKind.pdl~>~{~-

~}

Set the Kind property and check it.
To encode the values of this property you may use the names
defined in the macro at the end of this specification file.
~O~<StreamsKind.lido~>~{~-

~}

Specify a property to store the capacity of each entity.
~O~<StreamsCapacity.pdl~>~{~-

~}

Set and check the property Capacity:
~O~<StreamsCapacity.lido~>~{~-

~}

~O~<Streams.HEAD.phi~>~{
#include "Streams.h"
~}
~O~<Streams.h~>~{
#ifndef isSource
#define isSource    1
#define isSink      2
#define isConnector 3
#define infinite    99999
#endif
~}
~O~<Streams.c~>~{
~}

Generiert mit Camelot | Probleme mit Camelot? | Geändert am: 04.12.2013