EBNF

A context-free grammar can be described using Extended Backus–Naur form (EBNF) notation. This higher ‘metasyntax’ describes how another grammar should be parsed. This makes it a useful portable format for multiple programming languages to parse the same thing (if your system can read EBNF grammars it can parse a multitude of other grammars).

For example, this EBNF loosely defines org-mode syntax:

<DOC> = preamble heading*
preamble = [title] [author]
title = <'#+title'> text EOL
author = <'#+author'> text EOL
heading = level heading-text content*
<EOL> = '\n' | '\r' | #'$'
<SPC> = ' '
level = #'\*{1,}' SPC
heading-text = [status SPC] !status #'^.+'
text = #'^.+'
<content> = (EOL (EOL | heading | !level text))
todo = 'TODO'
done = 'DONE'
status = todo | done

See also:

  • Plain Text Files Are a Universal Storage Medium

    Plain text is the lingua franca for storing information that is simultaneously readable and writeable by computers and humans. It can even be converted to physical form and encoded back to digital form with no loss. Plain text file formats are unlikely to go away.

  • Org-Mode

    A package built into Emacs which combines outlining, task management, scheduling, code execution, spreadsheet, and much more. .org files have a specific syntax which can not be parsed using a formal grammar such as EBNF.