Edit This Page

Runtimes

Magic Console consumes the script Atom package service which is responsible for mapping source code grammars to runtimes and evaluating the source code. script currently supports 64 programming languages:

  • 1C (BSL) [Ø](#o-stroke)
  • AppleScript
  • Bash [**](#double-asterisk)
  • Behat Feature
  • C [*](#asterisk)[‡](#double-dagger)
  • C++ [*](#asterisk)[‡](#double-dagger)
  • C# Script [*](#asterisk)
  • Clojure (via Leiningen) [ϖ](#pi)
  • Coffeescript
  • CoffeeScript (Literate) [^](#caret)
  • Crystal
  • Cucumber (Gherkin) [*](#asterisk)
  • D [*](#asterisk)
  • DOT (Graphviz)
  • Elixir
  • Erlang [†](#dagger)
  • F# [*](#asterisk)
  • Forth (via GForth)
  • Gnuplot
  • Go [*](#asterisk)
  • Groovy
  • Haskell
  • ioLanguage (http://iolanguage.org/)
  • Java [***](#triple-asterisk)
  • Javascript
  • JavaScript for Automation (JXA)
  • Jolie [*](#asterisk)
  • Julia
  • Kotlin
  • LaTeX (via latexmk)
  • LilyPond
  • Lisp (via SBCL) [⍵](#omega)
  • Literate Haskell [*](#asterisk)
  • LiveScript
  • Lua
  • Makefile
  • MoonScript
  • MongoDB
  • NCL[#](#hash)
  • newLISP
  • Nim (and NimScript)
  • NSIS
  • Objective-C [*](#asterisk)[‡](#double-dagger)
  • Objective-C++ [*](#asterisk)[‡](#double-dagger)
  • OCaml [*](#asterisk)
  • Pandoc Markdown [††](#two-daggers)
  • Perl
  • Perl 6
  • PHP
  • PostgreSQL [§](#section)
  • Python
  • RSpec
  • Racket
  • RANT
  • Ruby
  • Ruby on Rails
  • Rust
  • Sage
  • Sass/SCSS [*](#asterisk)
  • Scala
  • Shell Script [**](#double-asterisk)
  • Swift
  • TypeScript
  • Dart
  • Octave
  • Zsh [**](#double-asterisk)
  • Prolog [¢](#cents)

NOTE: Some grammars may require you to install a custom language package.

You only have to add a few lines in a PR to support another.

Limitations

Ø 1C (BSL) code runs through OneScript interpreter in console mode.

^ Running selections of code for CoffeeScript (Literate) only works when selecting just the code blocks

Erlang uses erl for limited selection based runs (see #70)

* Cucumber (Gherkin), D, Go, F#, Literate Haskell, Jolie, OCaml, PowerShell, and Swift do not support selection based runs

Lisp selection based runs are limited to single line

ϖ Clojure scripts are executed via Leiningen's exec plugin. Both Leiningen and exec must be installed

C, C++, Objective-C, and Objective-C++ are currently only available for Mac OS X (where process.platform is 'darwin'). This is possible due to the commands xcrun clang and xcrun clang++. NOTE: Xcode and the Xcode command line tools are required to ensure xcrun and the correct compilers on your system.

# NCL scripts must end with exit command for file based runs

†† Requires the panzer pandoc wrapper https://github.com/msprev/panzer and the pandoc-flavored-markdown language package in Atom https://atom.io/packages/language-pfm

§ Requires the atom-language-pgsql package in Atom https://atom.io/packages/language-pgsql. Connects as user $PGUSER to database $PGDATABASE. Both default to the operating system's user name and both can be set in the process environment or in Atom's init.coffee script: process.env.PGUSER = ⟨username⟩ and process.env.PGDATABASE = ⟨database name⟩.

\** The shell used is based on your default $SHELL environment variable.

\*** Windows users should manually add jdk path (...\jdk1.x.x_xx\bin) to their system environment variables.

¢ Prolog scripts must contain a rule with the head main (e.g.main:- parent(X,lucas),writeln(X).). The script is executed with the goal main and is halted after the first result is found. The output is produced by the writeln/1 predicates. It requires swipl.

Add a runtime

Additional runtimes can be added to script's grammars.coffee.

  1. Fork the repo
  2. Add a new runtime
  3. Submit a PR

Clojure example

Clojure:
  "Selection Based":
    command: "lein"
    args: (context)  -> ['exec', '-e', context.getCode()]
  "File Based":
    command: "lein"
    args: (context) -> ['exec', context.filepath]