kugelschieber / asl Goto Github PK
View Code? Open in Web Editor NEWArma Scripting Language - a clean scripting language compiling to Arma 3 SQF scripts.
License: MIT License
Arma Scripting Language - a clean scripting language compiling to Arma 3 SQF scripts.
License: MIT License
Characters don't seem to be read correctly.
Example:
var x = 1;
var y = 2;
Results in:
x = 1;
vary = 2;
Move to
foreach unit in allUnits {
}
Disallow usage of "_x" as element variable.
Add line number and column to the error output.
Do not panic on parse errors!
addEventHandler(_c)("CuratorGroupPlaced", code("spawn(_this, \"ZeusGrpPlaced\")(BIS_fnc_MP);"));
will be:
_c addEventHandler ["CuratorGroupPlaced", {[_this, \"ZeusGrpPlaced\"] spawn BIS_fnc_MP;}];
Backslashes are required, but must be removed when code is inserted!
Remove .project, ToDo.md. Add run scripts.
Looks nice and handy! Unfortunately I am using the function framework since A3 and it doesn't look like your compiler supports this at the moment. Maybe you should consider compiling your functions into fn_functionname.sqf files and automatically register them in description.ext or config.
This way you could even make c-like entry point functions (int main()) using preinit/postinit.
Do you plan to emulate classes in the future?
by NeoArmageddon
see: https://forums.bistudio.com/topic/185649-asl-arma-scripting-language-compiler/
+=
-=
/=
*=
...
On Windows.
edit
When compiling multiple files at once, the output is sometimes not written for certain files.
Inlining code is not possible, example:
_x addEventHandler ["CuratorGroupPlaced", {[_this, "ZeusGrpPlaced"] spawn BIS_fnc_MP}];
Need a solution for this.
Build in unary functions were compiled with a "call".
Test the new implementation. It didn't worked espacially for the "format" function.
Like:
func myFunc(a = 1, b = "string") {
}
Requried for breakOut/breakTo.
createDiaryRecord(player)("Diary", ["Hinweis", hinweis]);
This is a rather broad idea and would involve not only changes in the parser/compiler but also some helper librarys in sqf. My idea is to expand your project not only to compile ASL to SQF files, but build a set of multiple ASL files to a complete sqf "program" in ArmA3.
Here is a basic sketch of the idea:
With the last you or somebody else could add new virtual types to ArmA3 as special sqf functions get automatically added to the A3 mission/addon and the corresponding functions can be used in ASL.
For example a new type Vector2 (ArmA3 only supports 3D vector commands until now):
Internally Vector2(x,y) is translated to [x,y]. But when something like
Vector2 _blah = Vector2(1,2) + Vector2(4,5);
is written in ASL it gets compiled to
_blah = [[1,2],[4,5]] call ASL_fnc_Vector2_Add;
//_blah = [5,7];
From here it should be easier to take this idea even further ;)
It would be good to split project into individual parts that you can use go get command to fetch code and make it possible to have multiple go projects in same place.
This would of course require to create organization for this project
Example usage:
go get github.com/arma-scripting-language/tokenizer
go get github.com/arma-scripting-language/parser
go get github.com/arma-scripting-language/asl
Add some unit testing capability.
private["_a","_b"];
Missing for functions.
This is currently not possible:
var x = allCurators-[someCurator];
is not implemented and not tested (?).
var x = [1, 2, 3];
var y = x[0]; // should give 1
Tests are broken, but code output seems ok.
If a file has the same name with a file in the most upper folder, it isn't compiled. The processes still creates an empty folder though.
Made some tests, imagine Input dir parameter is "D:\Folder". If the scripts are like the following:
"D:\Folder\test_script.asl"
"D:\Folder\new_folder\test_script.asl"
Only the script in the upper folder will be compiled, but en empty new_folder
will still be created. The following examples both work, so it has to do with the script in the first folder:
"D:\Folder\new_folder_0\test_script.asl"
"D:\Folder\new_folder_1\test_script.asl"
"D:\Folder\new_folder\test_script.asl"
"D:\Folder\new_folder\newer_folder\test_script.asl"
Add something like null for objNull, ...
Add support for constants and preprocessor.
I don't think pretty printing adds a new line after a while loop's closing bracket. I know pretty printing isn't that pretty to begin with, but it's just something I noticed.
func bsFunction(_a, _b) {
return _a+_b;
while (_i < []) {
hint("s");
}
alive(this_is_meanless_code);
bsFunction = {
params ["_a","_b"];
return _a+_b;
while {(_i<[])} do {
hint "s";
};alive this_is_meanless_code; <--Notice?
E.g.:
var x = ([1, 2, 3]-[2, 3])[0] == 1; // should result in "true"
... using the private command. Add automatically for all identifiers starting with an underscore.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.