Skip to content
Home of the ABS programming language: the joy of shell scripting.
Branch: master
Clone or download
Latest commit cedcfc1 Jun 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ast for else working May 5, 2019
bin
builds Basic interpreter Dec 16, 2018
docs bumped to 1.4.1 Jun 7, 2019
evaluator Allow negative in expressions, closes #239 Jun 7, 2019
examples Add unicode support, closes #191 Jun 6, 2019
lexer Digits should be allowed in variables, closes #233 Jun 6, 2019
object Fixing hash to JSON conversion Jun 6, 2019
parser
repl Fixed panic when running the REPL without a terminal, closes #225 Jun 6, 2019
scripts fixed release script May 29, 2019
tests proposals for string interpolation May 5, 2019
token added coveralls Feb 2, 2019
util rename util.InterpolateCmdVars() to util.InterpolateStringVars() May 5, 2019
.gitignore Add unicode support, closes #191 Jun 6, 2019
.travis.yml upgrade go version on travis Jun 6, 2019
CODE_OF_CONDUCT.md
CONTRIBUTING.md Update CONTRIBUTING.md Jun 6, 2019
Dockerfile
LICENSE Create LICENSE Dec 19, 2018
Makefile split bench and test_all Jun 6, 2019
README.md Update README.md Feb 4, 2019
go.mod Fixed panic when running the REPL without a terminal, closes #225 Jun 6, 2019
go.sum Fixed panic when running the REPL without a terminal, closes #225 Jun 6, 2019
main.go bumped to 1.4.1 Jun 7, 2019

README.md

abs language logo

Travis Status License Version undefined undefined
undefined undefined Coverage Status
undefined undefined undefined undefined

The ABS programming language

ABS is a scripting language that works best when you're scripting on your terminal. It tries to combine the elegance of languages such as Python, or Ruby, to the convenience of Bash.

tz = $(cat /etc/timezone);
continent, city = tz.split("/")

echo("Best city in the world?")

selection = stdin()

if selection == city {
  echo("You might be biased...")
}

See it in action:

asciicast

Let's try to fetch our IP address and print the sum of its parts, if its higher than 100. Here's how you could do it in Bash:

# Simple program that fetches your IP and sums it up
RES=$(curl -s 'https://api.ipify.org?format=json' || "ERR")

if [ "$RES" = "ERR" ]; then
    echo "An error occurred"
    exit 1
fi

IP=$(echo $RES | jq -r ".ip")
IFS=. read first second third fourth <<EOF
${IP##*-}
EOF

total=$((first + second + third + fourth))
if [ $total -gt 100 ]; then
    echo "The sum of [$IP] is a large number, $total."
fi

And here's how you could write the same code in ABS:

# Simple program that fetches your IP and sums it up
res = $(curl -s 'https://api.ipify.org?format=json');

if !res.ok {
  echo("An error occurred: %s", res)
  exit(1)
}

ip = res.json().ip
total = ip.split(".").map(int).sum()
if total > 100 {
    echo("The sum of [%s] is a large number, %s.", ip, total)
}

Wondering how you can run this code? Simply grab the latest release and run:

$ abs script.abs

Installation

The easiest way is to:

bash <(curl https://www.abs-lang.org/installer.sh)

then you can:

$ abs path/to/scripts.abs

Documentation

Visit abs-lang.org or check the examples directory, which contains a few brief scripts.

Contributing

Wanna hack on ABS locally? The recommended development environment is inside a Docker container -- simply:

  • make build (builds the container)
  • make run (sends you inside the development container)
  • make test (runs the abs tests)

After you make any change, simply run make test and check if any errors pops up. If everything looks fine that means you're ready to open a pull request!

Status

ABS is fresh and under active development, meaning exciting things happen on a weekly basis.

Have a look at the roadmaps here: to know of what version we're currently working on take a look at abs-lang.org/misc/technical-details.

You can’t perform that action at this time.