This is the homepage for tab, a kind of programming language/shell calculator.
Why another programming language?
Because tab is a special programming language unlike any other:
- It's statically-typed and type-infered.
- It also infers memory consumption and guarantees O(n) memory use.
- It is designed for concise one-liner computations right in the shell prompt.
- It features both a mathematics library and a set of data slicing and aggregation primitives.
- It is faster than all other interpreted languages with a similar scope. (Perl, Python, awk, ...)
- It is not Turing-complete. (But can compute virtually anything nonetheless.)
- It is self-contained: distributed as a single statically linked binary and nothing else.
- It has no platform dependencies.
You can think of tab as a kind of general-purpose query language for text files.
Download
Clone the git respository or download a statically-linked binary for x86_64 Linux.
Documentation
A complete tutorial and reference.
A concise cookbook of examples.
A primer on embedding into your own program.
History
- 2022-02-16
- Version 9.0 released. Changes:
- Added string interpolation with
`${...}` syntax.
- Defined the
$ function to be index.@ by default. (For easier indexing of arrays and tuples.)
- Added the
unflatten function.
- Expanded debug output when the
-vv command-line option is used.
- Added another variant for the
glue function.
- Fixed parsing precedence for
$.
- 2020-12-31
- Version 8.0 released. Changes:
- Added the implicit function call syntax using
$. $a is equivalent to $(@, a); the function $ must be first defined.
- Added a two-argument version of
if.
- Added syntactic sugar for filtering sequences;
[/ a] is equivalent to [try if(a, @)].
- 2019-10-04
- Version 7.2 released. Changes:
- Added the
product, mul and add functions.
- Added the
until function.
- Improved error output when an unknown function is called.
- 2019-06-20
- Verson 7.1 released. Changes:
- Changed the sematics for
array, iarray and sort functions when several arguments are passed; each argument is treated like an individual array member. This is a more 'natural' behaviour, but potentially code-breaking.
(That is, sort(4, 1, 3, 2) is now equivalent to sort.seq(4, 1, 3, 2).)
- Added the
sorted function to mimic the old behaviour of sort; with multiple arguments an array of one element (a tuple of input arguments) is returned.
The function sorted is meant for use as an aggregator in a map.
- Added the
combo function.
- 2019-04-19
- Version 7.0 released. Changes:
- Added the pipe operator:
... The code a .. b is equivalent to @=a, b.
- Changed precendence for function calls with
f.x syntax. From now on, f.x == b is parsed as (f.x) == b. Potentially code-breaking change.
- Fixed errors and crashes when an expression has no value. E.g.,
[@ : a=0].
- The
sample function will now accept arbitrary objects, not just arrays of atomic values.
- 2018-09-24
- Version 6.3 released: support for user-defined functions with no arguments.
- 2018-08-20
- Version 6.2.4 released: support for arrays in
has.
- 2017-08-04
- Version 6.2.3 released: support for negative indeces in
cut.
- 2017-06-09
- Version 6.2.2 released: fix bug in
recut.
- 2017-05-16
- Version 6.2.1 released: fix crash in
url_getparam.
- 2017-03-27
- Version 6.2 released. Changes:
- Added new functions:
find, findif, url_getparam.
- Added the
&& and || operators.
- Added
split and resplit as synonyms for cut and recut.
- 2017-01-23
- Version 6.1 released. Changes:
- 2016-09-27
- Version 6.0 released. Changes:
- Added the
def [a, b, c] construct for structured access to arrays and tuples.
- Performance enhancements.
- 2016-09-08
- Version 5.0 released. Changes:
- Added simple error handling functionality.
- Added versions of
cut and recut that accept and return sequences.
- Added new functions:
and, or.
- String to integer conversions will now autodetect number base.
- 2016-05-22
- Version 4.1 released. Changes:
- Support for hexadecimal unsigned int literals.
- Added new functions:
hex, uniques, uniques_estimate.
- Made
hash generic, it now works on values of all types.
- 2016-04-24
- Version 4.0 released. Changes:
- Added multithreading support! See documentation.
- Added new functions:
lines, iarray, merge.
- Added a
get function for arrays.
- Fixed bugs in
tuple and bucket.
- 2016-03-04
- Version 3.1 released. Changes:
- Added new functions:
box, peek, a two-argument version of take.
- 2016-02-18
- Version 3.0 released. Changes:
- Added support for computing simple tail-recursive functions. (Using the
<< ... >> syntax, see documentation.)
- Added a single-argument version of
seq.
- Fixed bugs in
count(), ngrams(), pairs(), triples().
- 2016-01-30
- Version 2.2 released. Changes:
- Fixed build errors on Mac OS X
- Added a new function:
eq
- Added documentation for embedded use.
- 2016-01-21
- Version 2.1 released. Changes:
- Added built-in documentation and functions reference. (See the '-h' command-line option.)
- Fixed a bug in
case()
- 2016-01-17
- Version 2.0 released. Changes:
- Made maps and arrays into implicit aggregators. (See documentation.)
- Added new functions:
bucket, explode, first, flip,
glue, map, ngrams, pairs, second,
stripe, take, triplets, while.
- Added a command-line option ('-s') to use sorted map keys. (Default is unsorted.)
- Added a loop-style version of
count.
- Added a list of examples to the documentation.
- Changed
hist to use lower bound instead.
- Fixed a bug in
sample.
- 2015.12.27
- Version 1.0 released.
- 2014.11.21
- First commit.