As such, I've periodically searched the forum for any alternative programming languages.
Now, there were many interesting programming languages, but many of them weren't a real plausible alternative to Lua.
From the ones I've seen, they often had limited capabilities, or were an extension of Lua itself.
So, I took it upon myself to create an alternative to Lua, which, naturally, would compile to Lua.
I've looked at several other prominent programming languages, and drew inspiration from them, as well from Lua itself to create what I call Luva (pronounced "Luu-va").
You can find the compiler here (pastebin get Kus6yZwV). It probably isn't the most efficient compiler design, but it gets the job done.
The compiler itself is under the Creative Commons Attribution-NonCommercial 4.0 International Public License (a summary of the license can be found here).
Similarly, you can also find it's Github here if you plan to contribute or report bugs. Be sure to give the full error, as well as the code you attempted to use if you are reporting an error.
Here are the arguments you can give the compiler:
Luva <filename/foldername> <output>
If you run Luva without any arguments, you're put into a console that's similar to the Lua program.
Though, it's still buggy.
Giving it just a filename will have the compiler attempt to compile the file.
By default, it will save to 'compiled,' but this can be changed by using the <output> argument.
Lastly, you can supply the compiler with a folder.
What this will do is go through the folder and attempt to compile every file there.
The files will be saved to an identical folder, with the content placing saved.
The default folder name is also 'compiled' unless the <output> argument is given to specify a different location.
Here's what sets Luva and Lua apart:
- Overloaded functions.
- Different combinations of repeat/while/until for a more customized loop.
- 20+ extra operators, such as >>, +=, –, etc.
- Syntax of tables ({1, 2, 3} becomes [1, 2, 3], and {A = "test", [2] = 30, B3 = 10} becomes [A: "test", 2: 30, B3: 10]
- then/end keywords replaced with { } (If <condition> { <statement> })
- Ability to make objects have their own types.
- Type specification in function declaration.
- Assigning default values when one isn't given.
- Switch statements.
- Preallocation of arrays.
- Native support for binary numbers.
- You don't need to end long comments, making it quicker to block off large sections of code.
- Three-way-comparison operator (<=>). A < B = false, A == B = nil, A > B = true. (Why is it here? Just because.)
- Identical operator (===), and it's counterpart (~==) to compare tables ([1,2,3] == [1,2,3] is false, [1,2,3] === [1,2,3] is true. Beware that the operator uses lazy index checking).
- Unless statements.
- Guard statements.
- Try, With, and Catch statements.
- OOP /w inheritance and sub classes.
- And some other stuff I've probably forgot to list.
- Require function to import APIs.
- Make code indented.
Spoiler
- Classes are now fully implemented.
- Classes have been much more heavily optimized.
- Added new 'metamethod' keyword for classes.
- Optimized the header, only declares variables when needed.
- Added a console line for quick testing (still sorta buggy).
- Optimized type checking a bit.
- Added a new 'unless' keyword, which is similar to 'guard' statements.
- Added ability to compile an entire folder of files.
- Fixed being able to use ':' (So, now you can do object:method() for example.)
- Added ability to use default values (=>) for classes.
- Added ability to use 'extends' keyword for sub-classes.
- Added a sort of 'property' type thing for classes (probably not what you're thinking of).
I'll probably have more properties which would make classes be compiled differently, for example.
You can find the tutorials on the language at its Github Wiki. Though, at this moment, it's still incomplete, so do bare with me.
I'd like feedback, more criticism than not, if possible; I'd like to know what you guys think, what you like, and what you dislike (maybe even why? :P/>)