Home

Data Definition Language

1 Introduction

This document is the specification of the Data Definition Language. Programs of this language are sets of UTF8 files of this language and describe structured data for the purpose of for exchanging that data between entities (humans and machines alike). The language provides scalar types (boolean type, number type, string type, and void type) as well as aggregate types (map values and list values).

The language is insipired by JSON (see ECMA-404 The JSON interchange syntax, 2nd edition, December 2017 for more information). A conversion between JSON and DDL is possible without the loss of data.

2 Lexical Specification

The lexical specification of the Data Definition Language is based on the Common Lexical Specification (see https://michaelheilmann.com/specifications/common-lexical-specification for more information). The Data Definition Language lexical specification profile is obtained by adjusting the definition of the Lexical.Word of the

Lexical.Word : Lexical.Boolean
Lexical.Word : Lexical.Number
Lexical.Word : Lexical.String
Lexical.Word : Lexical.Void
Lexical.Word : Lexical.Name
Lexical.Word : Lexical.LeftCurlyBracket
Lexical.Word : Lexical.RightCurlyBracket
Lexical.Word : Lexical.LeftSquareBracket
Lexical.Word : Lexical.RightSquareBracket
Lexical.Word : Lexical.Comma
/*whitespace, newline, and comment are not considered the syntactical grammar*/ Lexical.Word : Lexical.Whitespace
Lexical.Word : Lexical.Newline
Lexical.Word : Lexical.Comment

3 Syntactical Specification

The syntactical grammar describes the translation of the words into sentences. The goal non-terminal of the syntactical grammar is the sentence syn:Sentence symbol.

The words lex:Whitespace and lex:LineTerminator are removed from the sequence of words before the translation to sentences is performed.

The goal sentence syn:Sentence is defined by

syn:Sentence : syn:Value

The sentence syn:Value is defined by

syn:Value : syn:Map
syn:Value : syn:List
syn:Value : syn:String
syn:Value : syn:Number
syn:Value : syn:Boolean
syn:Value : sny:Void

The sentence syn:String is defined by

syn:String : lex:String

The sentence syn:Number is defined by

syn:Number : lex:Number

The sentence syn:Boolean is defined by

syn:Boolean : lex:Boolean

The sentence syn:Void is defined by

syn:Void : lex:Void

The sentence syn:Map is defined by

syn:Map : lex:LeftCurlyBracket
      syn:MapBody
      lex:RightCurlyBracket

syn:MapBody : syn:MapBodyElement syn:MapBodyRest
syn:MapBody : ε

syn:MapBodyRest : lex:Comma syn:MapBodyElement syn:MapBodyRest
syn:MapBodyRest : lex:Comma
syn:MapBodyRest : ε
syn:MapBodyElement : lex:Name lex:Colon syn:Value

The sentence syn:List is defined by

syn:List : lex:LeftSquareBracket
       syn:ListBody
       lex:RightSquareBracket

syn:ListBody : syn:ListBodyElement syn:ListBodyRest
syn:ListBody : ε

syn:ListBodyRest : lex:Comma syn:ListBodyElement syn:ListBodyRest
syn:ListBodyRest : lex:Comma
syn:ListBodyRest : ε

syn:ListBodyElement : syn:Value

4 Semantical Specification

The <Data Definition Language language describes structured data in terms of typed values. That is, each sentence of the syntactical specification translates to values each of which has type. The Data Definition Language knows six basic types sem:List and sem:Map, which are the so called aggregate types, and sem:Boolean, sem:Number, sem:String, and sem:Void, which are the so called scalar types. There exists a special type sem:Name.

4.1 Boolean Type

The type Boolean type has two values sem:true and sem:false which are expressed in the language by the words true and false, respectively (as defined in the syntactical grammar).

4.2 List Type

The type sem:List := [sem:Value] represents lists of values of type Value. A value of type sem:List< is expressed in the language by the sentence syn:List (as defined in the syntactical grammar). The i-th syn:ListBodyElement is the i-th value in the list.

Example

// A list with three numbers 1, 2, and 3.
[ 1, 2, 3 ]

4.3 Map Type

The type sem:Map := [sem:MapElement] represents a list of map elements. The values of type map expressed in the language by the sentence map. The i-th syn:MapBodyElement is the it-h sem:MapElement in the list.

A sem:MapElement is a tuple of which the first element is a value of the special type sem:Name and of which the second element is a value Value value. The syn:Name of the syn:MapBodyElement represents the first element of the tuple and syn:Value represents the second element of the tupel.

Example

// A map of
// text to 'Hello, World!'
// action to 'Print', and
// fontSize to 12.
{ text : 'Hello World!', action : 'Print', fontSize: 12 }

If two map entries of the same sem:Name occur in the same map, this is an error.

Example

The following Data Definition Language program defines a sem:Map value that contains two map entries with the same name lex:x. The first name/value pair maps to the value lex:'0' and second name/value pair to the number lex:'1'.

{ x : 0, x : 1 }

This is a semantical error.

4.4 Number Type

The type sem:Number type represents both two's complment integer numbers as well as IEEE754 floating-point numbers (without not-a-number values of infinity values). The values of type number are expressed in the language by the word sem:Number (as defined in the syntactical grammar). Note that the Data Definition Language does not impose restrictions on the size of the literals or the values. Implementations, however, may impose restrictions.

4.5 String Type

The type sem:String type represents UTF-8 strings. sem:String values are expressed in the language by the word syn:String (as defined in the syntactical grammar). At the end of the syntactical translation of a syn:String word, its escape sequences are replaced by the Unicode symbols they are representing. Furthermore, the opening and closing quotes are removed. Note that the Data Definition Language does not impose restrictions on the size of the literals or the values. Implementations, however, may impose restrictions.

4.6 Value Type

The type sem:Value type is the union type of the types sem:Boolean, sem:List, sem:Map, sem:Number, sem:String, sem:Void.

4.7 Void Type

The type sem:Void type has a single values void which is expressed in the language by the word sym: Void (as defined in the syntactical grammar).