Low-Level Scripting Language

A Fusion of C and Javascript

Low-Level Scripting Language

This post is a midnight braindump of an idea for a low-level scripting language that marries many of the good parts of C and Javascript (and sprinklings of other languages) together, at least in my opinion. It’s not fully fleshed out and may turn out to be a fever dream of impossibility come the morning, but I think it may very well be implementable in LLVM (hence the LLSL quasi-title) with most of the speed of C and most of the ease of Javascript.

Here’s a list of desired features:

Possible example code:

var print = require('print');

var helloWorld = 'Hello, World!';

print(helloWorld);

Simple hello world exercise looks identical to node.js

var print = require('print');

var < = (a byte, b byte) => `LT &a &b`;

print(8 < 3); # Prints 0

Defining a comparison operator with inline LLVM about as easy as the Hello, World.

var print = require('print');

var myStruct = {
    foo = 'bar',
    baz = [ 123, 456 ]
};

print(myStruct.foo); # Prints bar

Structs look JSON-ish. Debating reuse of equal sign, but would like to keep : free for custom operators.

var print = require('print');
var HashTable = require('HashTable'); # Functions that create structs should be capitalized

# Not sure if the following will be possible
var myHash = HashTable({
    foo = 'bar',
    baz = 123
}); # HashTable can be initialized with a struct and auto-boxes the values (somehow)

myHash.set('newValue', 'someValue'); # This will only work with the desired operator overloading

print(myHash.get('newValue')); # Prints someValue

There are some kinks to figure out with actual hash tables so they aren’t totally Java-y, but this seems feasible to my sleep-deprived brain. Perhaps need a typeof keyword, too.

Update on stories for my son

This past month has not been good for story writing. Lots of extra work, plus hosting a guest for the 4th one week, my son’s birthday another, his birthday party this past weekend… I intend to have the story written by this weekend and be back on track, though.