Skip to content
/ apl Public
forked from ngn/apl

An ancient programming language adapted to a JavaScript-dominated world

License

Notifications You must be signed in to change notification settings

tobia/apl

 
 

Repository files navigation

  _   _  ____ _   _          _
 | \ | |/ ___| \ | |        | |
 |  \| | |  _|  \| |      __| |__
 | |\  | |_| | |\  |     / _   _ \
 |_| \_|\____|_| \_|    / / | | \ \
    _    ____  _        | | | | | |
   / \  |  _ \| |       \ \_| |_/ /
  / _ \ | |_) | |        \__   __/
 / ___ \|  __/| |___    ____| |____
/_/   \_\_|   |_____|  |___________|

Build Status

An APL compiler written in CoffeeScript
Runs on NodeJS or in a browser

In-browser demo (See also: Paul L Jackson's web site and repl.it)

Supports: most primitives, dfns ({⍺ ⍵}), nested arrays, complex numbers (1j2), infinities (¯ or ), forks and hooks, strand assignment ((a b)←c), index assignment (a[b]←c), user-defined operators ({⍺⍺ ⍵⍵})

Doesn't support: traditional functions (∇R←X f Y), non-zero index origin (⎕IO), comparison tolerance (⎕CT), prototypes, NaN-s, modified assignment (x+←1), control structures (:If), object-oriented features, namespaces

Usage

Install NodeJS.

Download apl.js and make it executable:

wget http://ngn.github.io/apl/lib/apl.js
chmod +x apl.js

Running ./apl.js without arguments starts a REPL.

Running it with an argument executes an APL script:

./apl.js filename.apl

It can be require()d as a CommonJS module:

var apl = require('./apl');
console.log(apl('1 2 3 + 4 5 6').toString());

or used in an HTML page:

<script src="http://ngn.github.io/apl/lib/apl.js"></script>
<script>
    var result = apl('1 2 3 + 4 5 6'); // apl is a global variable
</script>

Editor support

Vim keymap and syntax

About

An ancient programming language adapted to a JavaScript-dominated world

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 59.8%
  • CoffeeScript 34.7%
  • APL 2.5%
  • CSS 2.3%
  • Other 0.7%