Links Notation

A natural, intuitive format for representing structured data as links between entities references to links

papa (lovesMama: loves mama)

What is Links Notation?

🌱 Natural

Most text can already be parsed as links notation

🔗 Flexible

Supports any number of references in each link

🌍 Universal

Can represent doublets, triplets, and N-tuples

📊 Hierarchical

Supports nested structures with indentation

The same three employee records written as Links Notation, YAML, JSON and XML

Examples

Doublets (2-tuple)

papa (lovesMama: loves mama)
son lovesMama
daughter lovesMama
all (love mama)

Triplets (3-tuple)

papa has car
mama has house
(papa and mama) are happy

Sequences (N-tuple)

I'm a friendly AI.
(I'm a friendly AI too.)
(linksNotation: links notation)
(This is a linksNotation as well)

Nested contexts

A line break inside parentheses opens a context that follows the same indentation rules as the document root.

parent (
  child
  (grandchild one)
  (grandchild two)
)

Objects as notation

Because parentheses nest, lino-objects-codec writes any JSON value as readable notation and reads it back.

(
  empInfo (
    employees (
      (
        name "James Kirk"
        age 40
      )
    )
  )
)

Complex Nesting

(linksNotation supports (unlimited number (of references) in each link))
(sequence (of references) surrounded by parentheses is a link)

Interactive Playground

Parsed in your browser by this repository's JavaScript implementation, not by an imitation of it.

Input

Output


                    

Documentation & APIs

JavaScript

Modern web development with ES modules

npm version

Rust

Memory-safe and fast parsing

Crates.io version

C#

High-performance .NET implementation

NuGet version

Python

Typed parser for scripts and notebooks

PyPI version

Go

Zero-dependency package for services

Go reference

Java

Published to Maven Central for the JVM

Maven Central version

PHP

Composer package for web back ends

Packagist version

Quick Start

JavaScript

import { Parser } from 'links-notation';
const parser = new Parser();
const links = parser.parse("papa (lovesMama: loves mama)");

Rust

use links_notation::parse_lino;
let links = parse_lino("papa (lovesMama: loves mama)").unwrap();

C#

var parser = new Link.Foundation.Links.Notation.Parser();
var links = parser.Parse("papa (lovesMama: loves mama)");

Python

from links_notation import Parser
parser = Parser()
links = parser.parse("papa (lovesMama: loves mama)")

Go

import lino "github.com/link-foundation/links-notation/go"

links, err := lino.Parse("papa (lovesMama: loves mama)")

Java

var parser = new io.github.linkfoundation.linksnotation.Parser();
var links = parser.parse("papa (lovesMama: loves mama)");

PHP

use LinkFoundation\LinksNotation\Parser;

$links = (new Parser())->parse('papa (lovesMama: loves mama)');