Skip to content

Basic DSL

The platform independent DSL “Basic” defines basic module types, element types, member types and options, that are going to be reused in other DSLs (e.g. “Persistence”). Here is the overview on all defined types.

Module-Types Element-Types Member-Types
Basic type field
Basic enumeration entry

In the following the types and their options are going to be described in more detail.

Module-Types

Basic

For all types and options it is necessary to set the module type “Basic” with a module’s “kind” attribute.

Example:

...
module MyModule kind = Basic;
...

Options for Module-Type “Basic”

Option Option-Type Description
no options defined - -

Element-Types

type

A “type” element is going to be used to define a type. This is similar to a type definition in programming languages. DSLs, that define element types that inherit from “type”, automatically get the capability to model “fields”.

Example:

type Item {
    field name : Text;
}

Options for Element-Type “type”

Option Option-Type Description
no options defined - -

Members and Member-Options for Element-Type “type”

Member: field

A “field” is, as the name implies, a field of a type. In programming languages there are other well-known terms for “field”: “property”, “attribute”. “fields” that are modeled with the DSL “Basic” have a similar meaning like in programming languages.

Option Option-Type Description
CollectionType Enumerated, single valued Possible value: Array, List, Set, SortedSet
EqualityRelevance Boolean Defines, if a “field” is relevant when two different types are compared with each other.
ReadOnly Boolean Defines, whether a “field” can only be read but not be modified.
DefaultValue Quoted Text Defines a default value for a “field”, that should be used to initialize it.
MultiplicityType Enumerated, single valued Possible value: OneToOne, OneToN, NToOne, MToN
Cardinality Numeric Defines, how many elements a “field” can hold, when it has the CollectionType “Array” set.

type - Predefined Types

The installation of the DSL “Basic” additionally includes some predefined “type” model elements. A generator maps these elements to platform specific types. You can define aliases for all of those predefined types. A guide and a sample can be found in the users guide.

Here you can see the predefined “type” elements.

Predefined Type Description
Date Date, Year, Month or Day
Datetime Date and Time
Time Time, Hours, Minutes, Seconds, Milliseconds
character one single Character
float128 signed Floating Point Number with 16 Bytes, a Java BigDecimal for instance
float64 signed Floating Point Number with 8 Bytes, a Java double or Delphi Double for instance
float32 signed Floating Point Number with 4 Bytes, a Java float or Delphi Single for instance
float16 signed Floating Point Number with 2 Bytes
sint128 signed Integer with 16 Bytes
sint64 signed Integer with 8 Bytes, a Java long oder Delphi Int64 for instance
sint32 signed Integer with 4 Bytes, a Java int oder Delphi Integer for instance
sint16 signed Integer with 2 Bytes, a Java short oder Delphi SmallInt for instance
sint8 signed Integer with 1 Byte, a Java int oder Delphi ShortInt for instance
string a String, a Collection of Characters
uint128 unsigned Integer with 16 Bytes
uint64 unsigned Integer with 8 Bytes, a Java BigDecimal or Delphi UInt64 for instance
uint32 unsigned Integer with 4 Bytes, a Java long or Delphi Cardinal for instance
uint16 unsigned Integer with 2 Bytes, a Java int or Delphi Word for instance
uint8 unsigned Integer with 1 Byte, a Java short or Delphi Byte for instance
uint1 a Bit, a Java boolean or Delphi Boolean for instance

enumeration

As the name implies, an “enumeration” is used to define an enumeration. Enumerations typically are going to be used as type of a “field”. Again similar to programming languages.

Example:

enumeration Gender {
    entry MALE;
    entry FEMALE;
}

Options for Element-Type “enumeration”

Option Option-Type Description
no options defined - -

Members and Member-Options for Element-Type “enumeration”

Member: entry

An “entry” defines an enumeration value in an enumeration.

Option Option-Type Description
no options defined - -

Member: field

see above, members of “type”

Option Option-Type Description
no options defined - -