Skip to content
Scripting language with pointers and native library access.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
libjit @ c2a0543
.gitmodules let the libjit submodule point towards my personal fork on github Jul 30, 2017
Makefile move from multiple handler functions in each ast to one vtable pointer Sep 19, 2018


Scripting language with pointers and native library access. PointerScript feels like C but has awesome features like operator overloading, dynamic typing and even though you have direct low level access your code is more safe thanks to boundary checks. Additionally finding errors is less painful as you get a full backtrace when a runtime error occurs or you receive e.g. a segmentation fault.

You can try the language online on the playground



Most of PointerScript is similar to Javascript and/or C. For a full Documentation see

Standard Library

PointerScript has no standard-library. You can use all C libraries using the built-in ffi (Import statement). There are a couple of easy-to-use libraries (sockets, regexp, http, json, lists, maps etc.) in this repository


You can run tests for the interpreter by executing the script in the repository.


The following is quite a bit of unknown code, we'll go through it (and some other things) below. Remember you can run and modify this code in your browser on the playground

//import the C functions puts and qsort
//using the import statement you can import any function from the C standard library
//using import foo, bar from "" you can import functions from any C library
//using import foo, bar from "otherScript.ptrs" allows you to put your code into multiple files
import puts, qsort;

//this defines an array of 4 variables, here they are all initialized with int's,
//but you can actually put anything in there (floats, strings, functions, etc.).
//defining arrays using curly brackets like var foo{128}; creates byte arrays instead
var nums[4] = [1337, 666, 3112, 42];

//as we can call any C function here we call qsort to sort the array we just defined.
//the last argument to qsort is a function pointer, here we use a lambda expression
qsort(nums, sizeof nums, sizeof var, (a, b) -> *as<pointer>a - *as<pointer>b);

//foreach allows us to easily iterate over arrays. Of course you could also use
//for(var i = 0; i < sizeof nums; i++) { /*...*/ } instead
foreach(i, val in nums)
	//string literals can be turned into string format expressions by putting $variableName
	//inside. Alternatively you could just use printf("nums[%d] = %d", i, val);
	puts("nums[$i] = $val");

More example code

There are examples including the usage of Types, Structs, Arrays, Threading and many more in the examples directory of this repository. The most interresting ones are listed here:

  • pi and circle Basic mathematic expressions and loops
  • types Using var and let
  • fork Using posix functions for creating child processes
  • array and bubblesort Basic array usage
  • struct Basic struct usage
  • threads Using libpthread
  • gtk Using GTK for creating a window with a clickable button.
  • window Using libSDL for creating X windows. (Example orginally by @Webfreak001)


Pointerscript uses libjit which is included in the repository as a submodule.

#Install dependencies (this might differ if you are not using debian)
# everything below apart from git and build-essential is required by libjit
sudo apt install git build-essential bison flex autoconf automake libtool texinfo

#Recursively clone the repository
git clone --recursive

cd PointerScript
make -j4 #-j specifies the number of tasks to run in parallel

#Done! PointerScript is at ./bin/ptrs
bin/ptrs --help

There is also syntax highlighting for atom in the language-atom repository. Use the following commands to install:

git clone
cd language-pointerscript
apm link


EUPL v1.1

Copyright (C) 2017 Jakob Löw (jakob@lö

Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in compliance with the Licence.

You may obtain a copy of the Licence at:

Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence for the specific language governing permissions and limitations under the Licence.

You can’t perform that action at this time.