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 removing a few words from the Full lexical specification profile. The removed words are:

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 sentence symbol.

The words whitespace and line_terminator are removed from the sequence of words before the translation to sentences is performed.

The goal sentence sentence is defined by

sentence : value

The sentence value is defined by

value : map
value : list
value : lexical:string
value : lexical:number
value : lexical:boolean
value : lexical:void

The sentence is defined by

map : lexical:left_curly_bracket
      map_body
      lexical:right_curly_bracket

map_body : map_body_element map_body_rest
map_body : ε

map_body_rest : lexical:comma map_body_element map_body_rest
map_body_rest : lexical:comma
map_body_rest : ε
map_body_element : lexical:name lexical:colon value

The sentence list is defined by

list : lexical:left_square_bracket
       list_body
       lexical:right_square_bracket

list_body : list_body_element list_body_rest
list_body : ε

list_body_rest : lexical:comma list_body_element list_body_rest
list_body_rest : lexical:comma
list_body_rest : ε

list_body_element : value

4 Semantical Specification

The Data Definition Language knows six basic types List and Map, which are the so called aggregate types, and Boolean, Number, String, and Void, which are the so called scalar types.

4.1 Boolean Type

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

4.2 Number Type

The type 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 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.3 String Type

The type String type represents UTF-8 strings. String values are expressed in the language by the word string (as defined in the syntactical grammar). At the end of the lexical translation of a 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.4 List Type

The type List represents lists of values. A value of type List is expressed in the language by the sentence list (as defined in the syntactical grammar).

Example

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

4.5 Map Type

The type Map represents maps from names to values. A value of type Map is expressed in the language by the sentence (as defined in the syntactical grammar).

Example

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

No two map entries with the same key may occur in the same map.

Example

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

{ x : 0, x : 1 }

This is a semantical error.