NML

NML logo

NML is a syntax framework for programming languages.

It provides a new alternative to XML and JSON.

NML is suitable for a broad array of programming applications, unlike XML and JSON, which are more specialised.

How is it different?

XML tags store data in attributes as well as a single element of tag content between start and end tags.

NML uses tags too. But NML tags unify the concepts of attributes and tag content into fields.

It's worth noting that any XML code can very easily be converted to NML. But code that takes full advantage of NML's expressive functionality is rather difficult to convert to XML.
XML<button id="test">Submit</button>
NML<button id={test} {Submit}>

NML fields are powerful enough to support multiple data types, as well as ordered lists of data elements, like JSON.
Examples
booleans true,   false
integers 42,   -6,   x6A2F
floating-point6.02,   b10110011.0s-6
strings {normal text},   [{literal character data}]
identifiersmyValue,   i,   href
tags<client name={Smith},{John} birthdate=<date y=1987 m=7 d=4>>

Syntactical features

Rather than each field being limited to a single value, like an XML attribute, you can supply an ordered list of multiple field elements, more like JSON. You can mix different data types within a list. Numbers can be integers or floating point, and can be input in binary, octal, decimal or hex. Boolean values are specified using reserved identifiers true and false.
ListField element


Unlike JSON, text elements can contain nested tags, just like XML, except not limited to a single content element per tag. (internally, the text element is broken into a list of string elements and tag elements, whenever nested tags are encountered):
Text


In XML, each tag begins with an identifier that classifies what kind of tag it is. NML generalises this into a 'type' field, which can contain a comma-delimited list of field elements in the same way as other fields. Rather than a tag having a single class identifier, it might be qualified by a namespace as well, or even a string or integer, depending on what's appropriate for whatever different languages NML is applied to.
Tag

But what does the code look like?

For more information, and to see code examples, download the NML spec in PDF format here.