All Projects → M4GNV5 → PointerScript

M4GNV5 / PointerScript

Licence: EUPL-1.2 license
Scripting language with pointers and native library access.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to PointerScript

windigo
Windows API and GUI in idiomatic Go.
Stars: ✭ 187 (+619.23%)
Mutual labels:  native, ffi
Android Luajit Launcher
Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
Stars: ✭ 87 (+234.62%)
Mutual labels:  native, ffi
winsafe
Windows API and GUI in safe, idiomatic Rust.
Stars: ✭ 110 (+323.08%)
Mutual labels:  native, ffi
sqlite3
The fastest and correct module for SQLite3 in Deno.
Stars: ✭ 143 (+450%)
Mutual labels:  native, ffi
Dart native
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.
Stars: ✭ 564 (+2069.23%)
Mutual labels:  native, ffi
rust-flutter-reactive
This is a sample app to improve consistency over Mobile App Development.
Stars: ✭ 25 (-3.85%)
Mutual labels:  native, ffi
auth0-ios-swift-sample
Auth0 Integration Samples for iOS Swift
Stars: ✭ 55 (+111.54%)
Mutual labels:  native
mjuzik
Curated Music app build on React Native
Stars: ✭ 44 (+69.23%)
Mutual labels:  native
react-native-paginated-listview
A simple paginated react-native ListView with a few customization options
Stars: ✭ 14 (-46.15%)
Mutual labels:  native
graderjs
💦 Turn your full-stack NodeJS application into a downloadable cross-platform binary. Also works for SPAs, or regular web-sites.
Stars: ✭ 147 (+465.38%)
Mutual labels:  native
react-tinder-card
A npm react module for making react elements swipeable like in the dating app tinder.
Stars: ✭ 184 (+607.69%)
Mutual labels:  native
phpmon
Lightweight, native Mac menu bar app that interacts with Laravel Valet. Helps you manage multiple PHP installations, locate config files and more.
Stars: ✭ 1,896 (+7192.31%)
Mutual labels:  native
three-laser-pointer
Interactive laser object for VR-like scenes
Stars: ✭ 26 (+0%)
Mutual labels:  pointer
tasit-sdk
A JavaScript / TypeScript SDK for making native mobile Ethereum dapps using React Native
Stars: ✭ 93 (+257.69%)
Mutual labels:  native
wxWidgetsTemplate
A template project for wxWidgets C++, with pre-set files and IDE projects, and allows for easy updates to wxWidgets
Stars: ✭ 13 (-50%)
Mutual labels:  native
lonlat bng
A multithreaded Rust library with FFI for converting WGS84 longitude and latitude coordinates into BNG (OSGB36) Eastings and Northings and vice versa (using OSTN15)
Stars: ✭ 20 (-23.08%)
Mutual labels:  ffi
idris-ffi-example
A minimal example of the Idris C FFI
Stars: ✭ 14 (-46.15%)
Mutual labels:  ffi
buke
full text search manpages
Stars: ✭ 27 (+3.85%)
Mutual labels:  ffi
native-xr-for-web
Add iOS and Android build with AR capabilities to your website or web-based app.
Stars: ✭ 27 (+3.85%)
Mutual labels:  native
Multiplatform-LiveData
Multiplatorm implementation of LiveDatas / MVVM in kotlin android & native ios
Stars: ✭ 95 (+265.38%)
Mutual labels:  native

PointerScript

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

Language

Documentation

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

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

Testing

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

Introduction

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 "file.so" 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
  • 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)

Installing

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 https://github.com/M4GNV5/PointerScript

#Compile...
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 https://github.com/M4GNV5/language-pointerscript
cd language-pointerscript
apm link

License

EUPL v1.2

Copyright (C) 2020 Jakob Löw (jakob@löw.com)

Licensed under the EUPL, Version 1.2 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: http://ec.europa.eu/idabc/eupl.html

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].