1.0.0 • Published 12 months ago

effml v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

EffML

EffML is a lightweight and efficient data format for working with structured documents. The structure of a sample HTML document look like this:

doctype 'html'
head {
  title 'Page\'s Title'
  meta { charset 'UTF-8' }
  meta { viewport 'width=device-width, initial-scale=1.0' }
  link { rel 'stylesheet' href 'styles.css' }
  link { rel 'icon' href 'favicon.ico' }
}
body {
  h1 { 'Hello, World!' }
  p {
    'This is an example EffML document.'
    'It\'s awesome!'
    div {
      'Some text inside a div.'
    }
  }
  img {
    src 'image.jpg'
    alt 'Sample Image'
  }
}

Design concepts

Key points of the language design:

  • Extremely simple and straightforward with just a few syntax rules without any exceptions.
  • Does not use any unnecessary characters such as equal signs for attributes etc.
  • Does not rely on whitespace in any way.
  • Super simple parsing.

Syntax

The syntax of EffML is very simple. It consists of just two types of entities: attributes and nodes. Attributes are key-value pairs like this:

src 'image.jpg'
alt 'Sample Image'

The values can be only strings enclosed in single quotes. The keys have to be valid names.

Node is either string or element. Element is a pair of a name and a content enclosed in curly braces. The content is a list of attributes and nodes.

div {
  some 'attribute'
  'Some text inside a div.'
}

The name has to be a valid name. The content can be empty.

Names and strings

Strings can contain any Unicode characters except for single quotes. Single quotes can be escaped with a backslash.

Names can contain any ASCII character defined by the following regular expression:

/^[:A-Z_a-z\xc0-\xd6\xd8-\xff]([:A-Z_a-z\xc0-\xd6\xd8-\xff]|[-.0-9\xb7])*$/
1.0.0

12 months ago