Current issue

Vol.26 No.4

Vol.26 No.4

Volumes

© 1984-2017
British APL Association
All rights reserved.

Archive articles posted online on request: ask the archivist.

archive/in press

In press

 

  • Proof for author
  • 0.1

AntLang – A modern APL system

Anthony Cipriano

Why AntLang?

Because they can’t be enough APLs!

OK, there is a bit more to it: AntLang is intended to be practical.

It does multi-threading, system-interaction, easy File-I/O and many many more.

Syntax

Most of the syntax is inspired by K and Q, because they are very convenient and compact languages.

However, they do some steps in the false direction, like making a difference between verbs and functions.

q)2+2
4
q)3{x+y}5
’type

In AntLang, verbs are functions and functions are verbs, so both of the above examples execute correctly.

    a)2+2
a1:4
a)3{x+y}5
a2:8

AntLang does not allow juxtaposition, which allows statically parsing AntLang code without knowing the type of things.

a)sin 2
Syntax Error
a)sin[2]
a1:0.9092974268256817
a)sin@2
a2:0.9092974268256817

It makes source code a bit longer sometimes, but it implementing AntLang very easy compared to K or J, which is why there already exist multiple implementations (hsAntLang, minAntLang, tryAntLang, ....) .

APL is the only language I know, that does not allow writing classic BNF parsers, so for me, this is a big improvement.

However, it does not allow something like “atom atom atom”, since it would be interpreted as “atom function atom”.

a)1 2 3
Domain Error: 1 2 3
a)<1;2;3>
a1:<1;2;3>

Semantics

Arrays make it really hard to talk about deeply nested things, like trees or so, which is why AntLang uses sequences instead.

However, you can still think in arrays using sequences.

a)$|<<1;2>;<3;4>;<5;6>> / "$" is mingle, "|" is apply, "$|" is transpose
a1:<<1;3;5>;<2;4;6>>

It only has two concisely chosen adverbs: reduce and pair each.

a)1*/iota[5]
a1:120
a)<1;2;3>+/:<4;5;6>
a2:<<5;6;7>;<6;7;8>;<7;8;9>>

Most other APL adverbs are implemented as classic verbs, which is allowed in terms of static parsing, so that functions can be easily passed to other functions.

Conclusion

It is definitely a good idea to try out AntLang, becuase it brings static parsing and functional programming to APL, which is definitely something you have to try.

You can get more information and even read its source code on
GitHub: github.com/ac1235/AntLang

script began 19:15:40
caching off
debug mode off
cache time 3600 sec
indmtime not found in cache
cached index is fresh
recompiling index.xml
index compiled in 0.2581 secs
read index
read issues/index.xml
identified 26 volumes, 101 issues
array (
  'id' => '10501730',
)
regenerated static HTML
article source is 'XHTML'
completed in 0.2855 secs