5

What are technologies like XML, JSON, and YAML classified as?

I already looked at

But neither appeared accurate... None of them are really meant for creating queries. And JSON isn't a language, so DSL doesn't apply.


I see those technologies used a lot with configuration files and passing data between web services and web clients. Is there a general category or term to describe them?

closed as unclear what you're asking by user40980, gnat, Kilian Foth, Bart van Ingen Schenau, GlenH7 Dec 15 '14 at 16:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    On wikipedia, they are all under Category:Data serialization formats – user40980 Dec 15 '14 at 0:50
  • @MichaelT Since when is YAML used for serialization? I've only ever seen it used for configuration. – Evan Plaice Dec 15 '14 at 18:12
  • @EvanPlaice the configuration file could be thought of as a sterilization too. You could easily create a configuration object that the YAML configures to. A glance at the yaml gem for ruby starts out with "This module provides a Ruby interface for data serialization in YAML format." – user40980 Dec 15 '14 at 23:23
3

Declarative Languages

Declarative programming is often defined as any style of programming that is not imperative. A number of other common definitions exist that attempt to give the term a definition other than simply contrasting it with imperative programming.

For example:

  • A program that describes what computation should be performed and not how to compute it
  • Any programming language that lacks side effects (or more specifically, is referentially transparent)
  • A language with a clear correspondence to mathematical logic.[4]

Source: Wikipedia

Declarative languages are intended to express what -- not how -- a program should accomplish.

Web based design (ie HTML/CSS) are both good examples. They describe instructions for the browser on how a webpage should be structured and represented visually but possess no ability of their own to produce the output. How browsers/clients consume their code can be wildly different as long as the output produces the intended result as per the W3C/WHATWG specify.

Serialization/deserialization and DSLs (Domain Specific Languages) like SQL are another good example. They are designed and intended to follow a strict standard of functionality regardless of what language/platform they are run on.

The key to a good declarative language is that it does a good job of describing a data/process in simple, finite terms with little room for subjective variation.

The key to a good implementation of a system that consumes/produces declarative code is consistency with any/all other systems that consume it.

Markdown is a good example of a useful declarative language that suffers from a poor initial specification/design. Markdown evolved organically in the wild because of its usefulness. Unfortunately, in the absence of a well defined specification, there are now a lot of different variations when it comes to implementation. Many notable developers have taken the standardization of Markdown as a personal mission but -- at best -- an official standard will only be accepted through the slow/painful process of survival of the fittest. Even then, variations will always exist to some extent.


Technically, there is a formal system for classifying languages called the Chomsky Hierarchy. It describes is mathematical terms the different types of programming grammars based on how they're parsed.

XML, JSON, and YAML generally fall under context-free or context-sensitive languages depending on how they're used.

Considering usage, I think Declarative is a better term to describe what you're looking for.

  • 2
    HTML and Ant would be good examples of Declarative languages, however YAML and XML aren't specifying what computation should be performed. They just are, so I think it's worth mentioning. – Neil Dec 15 '14 at 9:01
  • @GlenH7 JSON is a language, specifically it's a context-free language that follows a context-free grammar. It's not a 'language' in the classical Turing complete sense but that's why the different levels of classification exist. – Evan Plaice Dec 15 '14 at 18:02
  • @Neil "aren't specifying what computation should be performed". That's the point. Declarative languages aren't required to illustrate how the program should perform a task. They only describe the what. In the case of HTML/ant the data describes steps that the program should take to construct a document or perform a list of tasks. Their structure is not imperative, though their data/structure can be used to denote the steps that an imperative program should take. – Evan Plaice Dec 15 '14 at 18:08
  • @GlenH7 It doesn't matter whether it's a formal language or a subset of another. It can be produced and consumed in a context free manner using a well defined context free grammer. I'm defining the behavior declarative languages based on the characteristics of how they're used and parsed. Your edit was unrelated to my original goal/intention. – Evan Plaice Dec 15 '14 at 18:19
  • 1
    @Neil OK, I agree then. Wikipedia's defining it as a 'program' is is wrong, unless you take a very liberal view of what a 'program' actually is. I guess that you could say that a HTML source file is a 'program' but HTML is strictly declarative so it requires a HTML client to be useful. In comparison to English language structure. Where a programming language would contain nouns (ie data), and verbs (ie statements, subroutines). A declarative language contains only nouns, it isn't capable of performing defining actions on its own. – Evan Plaice Dec 16 '14 at 20:23
8

XML = "eXstensible Markup Language"

YAML = "YAML Ain't Markup Language" (Though it was originally "Yet Another Markup Language".)

Though in truth people think of them more like data formats (which JSON is) rather than languages partly because people assume "Language" == "Turing Complete".

  • So, I shouldn't group them? I should rather think of them individually as different things? – user160274 Dec 15 '14 at 0:44
  • 2
    I have no clue, because I have no idea how you are grouping things. If you are making groups of ways people format data, then yes, they belong together. If you are making groups based on the first letter of their name, then no, they shouldn't be grouped together. – Steven Burnap Dec 15 '14 at 0:48
  • 1
    "YAML Ain't Markup Language" doesn't lend much credence to your implicit idea that YAML is a markup language... – raptortech97 Dec 15 '14 at 12:26
2

Despite having the word language in them, I would not consider them programming languages, but rather data formats. I know that XML has been used as the format for some DSLs, probably likewise for YML.

A language does not have to be Turing complete to be a programming language, but it does need to be active -- without exceeding the standard definition, these "languages" do not include meanings that act upon the data.

XSLT is a language that uses XML, but XSLT is more than just XML --it attaches meanings beyond the DTD it attaches meaning that includes actions to be taken on the data. While not mentioned, HTML, like XSLT, is a programming language. XSLT is Turing complete while HTML is not. HTML is a declarative language -- it says to emphasis some content or that some content is a heading or to be bolded.

The whole point of XML is for it to NOT include actions -- it is data. What that data means, whether it is a todo list or a program for calculating Fibonacci sequences is inconsequential -- XML is data and the related DTD describes its format, the MEANING of the data is determined by the consumer. XML does this because HTML mixed the data and the meaning, which proved somewhat, uhm, fragile.

In short, just accept it as sloppy terminology, and move on.