undamental ata anguage

A fundamental base for data and scripting languages

Synopsis

FDL is a document specification - intended to act as a foundation for documents representing data or scripts.

Language overview

In a nutshell, the fundamental elements of the FDL language are as follows:

Class
Element
:
Example FDL code
Strings {
Double-quoted
:
"Double quoted strings"
Single-quoted
:
'Single quoted strings'
Slant-quoted
:
`Slant quoted strings`
Comments {
Single-line
:
# preceded by a hash
Multi-line
:
<#enclosed by hashes & angle brackets#>
Annotations {
Single-line
:
@ preceded by a "at" symbol
Multi-line
:
<@enclosed by hashes & angle brackets@>
Others {
Identifiers
:
continuous strings from A_Restricted_Alphabet
Numbers
:
12 300 4.56 0.1E23 2_10101
Brackets
:
(...), [...], {...} - must nest correctly
Symbols
:
. = : , ; ~ & $ ! ? % \ / * ^ + - or |
Whitespace
:
Spaces and ends of lines

FDL is intended to form a common foundation on which to build data representation languages and computer programming languages.

As such, it places relatively few restriction on the permitted content. It does, however, completely specify the lexical breakdown of a language - in particular, it allows stream parsers to be constructed that output token streams representing the content.

Simple examples

To illustrate the format with a couple of examples:

@fdl version="1.0" schema="http://fdl.mandala.co.uk/fds/uni.fds"
universe={
 # first object
 object={
  name="Green object"
  coordinates=(1.5 3.6 2.9)
  velocity=(2.3 4.3 2.9)
  attributes={
   colour=green
   mass=10.8
   elasticity=0.9
  }
 }
}
uni.fdl | uni.fds
@fdl version="1.0" schema="http://fdl.mandala.co.uk/fds/dat.fds"
data_types={
 # example - illustrating various data types
 example_object={
  list1=(string="xxx" boolean=true value=null)
  list2=(integer=8 decimal=0.5 identifier=xxx)
  list3=("lists" ("can" ("be" ("nested"))))
  @annotation:allow:(nested=objects)
  nested_object={
   title="Anonymous"
   chain=consecutive.identifiers.permitted
  }
 }
}
dat.fdl | dat.fds

Language elements in more depth

  • Strings
    • Double quoted
      • Example: "Double-quoted string"
    • Single quoted
      • Example: 'Single-quoted string'
    • Slant quoted
      • Example: `Slant-quoted string`
  • Comments
    • Single line
      • Single line comments start with a # and continue to the end of the line.
      • Example: # Single line comment
    • Multi line
      • Multi-line comments are surrounded by hashes and enclosed by angle brackets.
      • Multi-line comments may be nested.
        This contrasts with the situation in languages such as Java, C and C++ - where nested comments are not possible.
      • Example: <#Multi-line comment#>
  • Annotations
    • Single line
      • Single line annotations start with a @ and continue to the end of the line.
      • Example: @ Single line annotation
    • Multi line
      • Multi-line annotations are surrounded by hashes and enclosed by angle brackets.
      • Example: <@Multi-line annotation@>
  • Primitives
    • Identifiers
      • These are ASCII text from a restricted alphabet.
      • They must start with an alphabetic character - and continue with alphanumeric characters and the underscore.
      • Example: sample_identifier
      • No spaces or punctuation are permitted.
      • As a regular expression they should match:[A-Za-z_][A-Za-z0-9_]*
    • Numbers
      • A continuous string of digits.
      • Example: 123456.789
      • As a regular expression they should match: [-]*[0-9][A-Za-z0-9_.]*
      • The distinction between integers and decimals is not dealt with at the level of the language.
    • Brackets
      • Round brackets (...), square brackets [...] and braces {...} are permitted.
      • Brackets must always form a correctly nested heirarchical tree structure.
        Bracket type mismatches, closed brackets which are not opened - and failure to properly close brackets - are all parsing errors.
      • Example: {([...])}
    • Symbols
      • A single character from the list:. = : , ; ~ & $ ! ? % \ / * ^ + - or |
      • Example: *.*
    • Whitespace
      • Spaces and all control characters (including line feeds and tabs) qualify as white space.

Schemata

Schemata are used to describe the format of FDL documents.

Currently, FDL has one main associated schema language - known as FDS.

FDS is described in more detail here.

Errors and warnings

Descriptions of many of the errors that can be produced when dealing with FDL documents.

Comparisons

  • Comparison with XML

    XML is a document-centric format. By contrast FDL is a data-centric format.

    When representing data, FDL typically doesn't have so much "visual noise" as XML - and as a result is more concise and readable.

    There are typically fewer "<" and ">" and "/" symbols used - and numbers do not need to be quoted.

    There is no need for redundant, duplicated tag names.

    FDL also has proper list objects - making representing lists cleaner and neater.

    FDL : XML
    sample:p=0:{highlight:{"Test"}}
    :
    <sample p=0><highlight>Test</highlight></sample>
    headline:{bold:{"Example"}}
    :
    <headline><bold>Example</bold></headline>
    object:count=1:max=10
    :
    <object count="1" max="10" />
    shopping:("loaves" "fishes")
    :
    <shopping>loaves,fishes</shopping>
    # Sample comment
    :
    <!-- Sample comment -->
    "Document text"
    :
    Document text

License

Everything on this web site has been placed into the public domain by its author.

Version

FDL has yet to reach version 0.01.

Consequently, please pay close attention to the following notice:


Tim Tyler | Contact