UP | HOME

Support via Liberapay, GitHub or PayPal

Babel: Languages

Table of Contents

Babel Languages

Babel supports a growing number of programming languages. Table 1 lists supported languages, indicates how they are identified in Babel, and provides links to documentation and to other software required for full support. The Location column indicates how support for each language is distributed. core languages are distributed with Emacs. contrib languages are distributed in the Org-mode contrib directory because their copyright has not been assigned to the FSF. package languages are distributed outside of Org-mode through the Emacs package system.

Table 1: Languages supported by Babel
Language Identifier Requirements Location
ABC abc abcm2ps, abc-mode core
Asymptote asymptote asymptote, asy-mode core
Awk awk awk core
Axiom axiom, spad axiom, OpenAxiom, or FriCAS, axiom-environment package
C C none core
C++ cpp none core
Calc calc none core
Clojure clojure Clojure, Clojure Mode, CIDER, Leiningen core
comint comint   core
Coq coq   core
CSS css none core
D D D core
Ditaa ditaa ditaa (bundled with Org-mode) core
Dot (Graphviz) dot dot core
ebnf ebnf   core
Elixir elixir elixir, Erlang package
Emacs Lisp emacs-lisp none core
Eukleides eukleides eukleides contrib
Fomus fomus fomus (music notation) contrib
Forth forth gforth core
Fortran F90 fortran core
Gnuplot gnuplot gnuplot, gnuplot-mode core
Google Translate translate google-translate package
Groovy groovy   contrib
Haskell haskell haskell, haskell-mode, inf-haskell, lhs2tex core
HTML browser PhantomJS, ob-browser.js package
http request http cURL package
Io io   core
iPython ipython ob-python package
J J J, j-mode core
Java java java core
Javascript js node.js core
Julia julia ess contrib
Kotlin kotlin Kotlin, kotlin-mode package
LaTeX latex latex, auctex, reftex core
Ledger ledger ledger core
Lilypond ly lilypond music notation core
Lisp lisp lisp, slime core
Lisp Flavored Erlang lfe lfe package
Make makefile none core
Mathematica mathematica   contrib
Mathomatic mathomatic Mathomatic contrib
Matlab matlab matlab, matlab.el core
Maxima max maxima, Common Lisp, gnuplot (optional) core
MongoDB mongo mongoDB package
Mscgen mscgen Mscgen core
Neo4j cypher neo4j, cypher-mode package
Objective Caml ocaml ocaml, tuareg-mode core
Octave octave octave core
Org org none core
OZ oz Mozart which includes a major mode contrib
Perl perl perl, cperl-mode (optional) core
Picolisp picolisp PicoLisp core
PlantUML plantuml   core
Processing processing   core
Prolog prolog SWI Prolog package
Python python python, python-mode (optional) core
R R R, ess-mode, tikzDevice core
rec rec GNU Recutils package
Ruby ruby ruby, irb, ruby-mode, inf-ruby mode core
Sass sass sass, sass-mode core
Scala scala scala core
Scheme scheme none core
Screen screen   core
Sed sed   core
shell shell a shell core
Shen shen shen, shen-mode core
SQL sql an RDBMS core
SQLite sqlite SQLite, sqlite3, SQL mode core
Stan stan Stan, Stan mode core
Standard ML sml Standard ML, sml-mode package
Stata stata Stata, ess-mode contrib
Tcl tcl tclsh contrib
Typescript typescript node.js, typescript package
Vala vala Vala core

Note: Many languages in Table 1 still require documentation. A template is provided in the worg git repository for the addition of language documentation.

Note also that there are some inconsistencies across languages.

Configure active languages

To add support for a particular language to your Babel installation first make sure that the requirements of the language are met, then you may customize the org-babel-load-languages variable, update the variable's value manually by adding1

(lang . t)

to its definition. A line like the following to explicitly remove support for a language.

(lang . nil)

Here is an example manual configuration of this variable, which enables support for R, and disables support for emacs-lisp.

;; active Babel languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (emacs-lisp . nil)))

Develop support for new languages

The core Babel functions (viewing, export, tangling, etc…) are language agnostic and will work even for languages that are not explicitly supported. Explicit language-specific support is required only for evaluation of code blocks in a language.

Babel is designed to be easily extended to support new languages. Language support is added by defining language-specific functions using a simple naming convention. The full suite of possible language specific functions need not be implemented all at once, but rather it is possible (and encouraged) to develop language-specific functionality in an incremental fashion – Babel will make use of those functions which are available, and will fail gracefully when functionality has not yet been implemented.

There is a short Emacs Lisp template (ob-template.el) which can be used as a starting point for implementing support for new languages. To fetch a copy of this file, please clone Worg:

~$ git clone https://code.orgmode.org/bzg/worg.git

You should find org-contrib/babel/ob-template.el.

Developers are encouraged to read the Org-mode contribution instructions in the hope that the language support can be included into the Org-mode core.

Footnotes:

1

If you want to load a language in the contrib directory by specifying it in the org-babel-do-load-languages variable, then please follow these instructions. Otherwise, a language in the contrib directory must be explicitly required with e.g. (require 'ob-oz) after a path to the contrib directory has been added to load-path.

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.