1
Modification Help / eggscript -- torquescript extension (v0.2)
« on: August 30, 2020, 11:04:08 PM »https://github.com/bansheerubber/eggscript
i've been working on making a torquescript tokenizer/lexer/whatever you want to call it and the vanilla torquescript part of it is finished. i was thinking that i could add a bunch of additional features that could polyfill down to normal torquescript. ideas include:
- vector operators, no more nested vectorAdd/vectorSub bullstuff. you might write:
%distance = `||%vector1 - %vector2||`;
%dot = `%vector1 . %vector2`;
not really sure how to do the syntax for operations like cross product, distance, unit vectors, etc. open to any ideas on this one
- arrays are treated as objects. this would be polyfilled down to something efficient, but in eggscript you might write:
%array = [];
for(%i = 0; %i < 50; %i++) {
%array.append(getRandom(1, 5000));
}
%array.sort();
for(%number in %array) {
echo(%number);
}
- inlining functions for optimization (no more 2-6 microsecond overhead for calling functions!)
- using a string table to shorten variable names (better performance, especially for large loops)
features already in eggscript include:
- string templates. i.e. %variable = $"Welcome to {%client.getPlayerName()}'s server!"; will polyfill to %variable = "Welcome to " @ %client.getPlayerName() @ "'s server!";
- minification https://bansheerubber.com/i/f/GeuGv.png
- de-minification aka pretty printing
willing to look into additional syntax to add to this, really looking forward to making a bunch of cool extensions