Code Monkey home page Code Monkey logo

sdlang-d's Introduction

SDLang-D Build Status

An SDLang (Simple Declarative Language) library for D, to read and write SDLang. Both a DOM and a Pull Parser are provided.

Officially supported compiler versions are shown in .travis.yml.

SDL is a data language like JSON, XML or YAML, except it's:

  • Less verbose than JSON and XML.
  • Type-aware.
  • Easier to learn and read than YAML.

This is what SDL looks like (some of these examples, and more, are from the original SDL site:

// A couple basic values
first "Joe"
last "Coder"

// Supports values, named attributes, and various data types
numbers 12 53 2 635
names "Sally" "Frank N. Stein"
pets chihuahua="small" dalmation="hyper" mastiff="big"

mixed 34.7f "Tim" somedate=2010/08/14

// Supports child tags
folder "myFiles" color="yellow" protection=on {
    folder "my images" {
        file "myHouse.jpg" color=true date=2005/11/05
        file "myCar.jpg" color=false date=2002/01/05
    }
    folder "my documents" {
        document "resume.pdf"
    }
}

Tags are of this form:

[tag name] [values] [attributes] [children]

Attributes are simply values with names.

Tag and attribute names can optionally include a namespace prefix (ie, namespace:name). All parts are optional, the only exception being that an anonymous (ie, no name) tag must have at least one value.

Also:

  • Tags are separated by either newline or semicolon.
  • Whitespace and indentation is not significant (other than newlines).
  • The line-continuation operator is \ (backslash). This can be used to split a tag across multiple lines.
  • Line comments start with either #, // or --.
  • Block comments start with /* and end with the first occurrence of */ (ie, they do not nest).
  • Values always come before the attributes.
  • All the data types and syntax details are described in the Language Guide.
  • Note that, unlike C-based languages, opening curly braces must be on the same line, not the next line. Why?.

For more details on the langauge, see the Language Guide.

Differences from original Java implementation

  • License is zlib/libpng, not LGPL. (No source from the Java or Ruby implementations was used or looked at. The libraries were used to test compatibility, but the actual source code was not viewed.)
  • API is completely redesigned for D.
  • Anonymous tags are named "" (empty string) not "content".
  • Dates with unknown or invalid time zones use a special type indicating "unknown time zone" (DateTimeFracUnknownZone) instead of assuming GMT.

Documentation

sdlang-d's People

Contributors

abscissa avatar brad-anderson avatar coldencullen avatar lesderid avatar s-ludwig avatar schuetzm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.