Killa: a new scripting language for Love 0.8.0
Posted: Wed May 02, 2012 12:32 am
UPDATE 04/2013
I'm working in the 0.3 version of my language, making Killa a bit more JavaScript-like
updated the latest version with a port of Notch's minecraft4k.js demo: http://jsdo.it/notch/dB1E
The code is pretty much similar to the JavaScript one, so I think I'm getting closer where I wanted:
https://bitbucket.org/ex/love/raw/7fe5e ... raft4k.kia
however the performance is poor compared with Canvas and Flash due to the time spent going from the script side to the C++ side,
Flash has a Bitmap data structure that helps a lot, I'll see what I can do for Love-Killa, using shaders for everything is not my thing,
I want this engine to be used by kids
Also because playing with pixels on the screen was very fun and the foundation of the Flash 3D engines before Stage3D.
For Windows there is a pre-built executable. If you need more details, please comment here.
UPDATE:
Hello, I've updated the engine to use the latest version (0.2) of my language Killa. Some highlights:
- Bitwise operators. They are implemented as VM opcodes and are one order of magnitude faster that Lua 5.2 bit32 library functions.
- Many bug fixes and little improvements like:
- Python-like multiline strings
- All the string and table functions are now using index base 0 instead of 1. Test scripts added.
- Fixed bugs with references and compound operators.
Overall this release is a lot more stable than the initial release, I have been using Killa to solve Project Euler problems:
http://elrinconde-ex.blogspot.com/2012/ ... ed-in.html
I was able to beat Python in performance using bitwise operations:
http://elrinconde-ex.blogspot.com/2012/ ... t-lua.html
There is minimal documentation in the Github wiki but it needs lots of work. I'll work on that later, I'm just adding samples and test cases by the moment, but you are free to ask anytime.
About the future, I'm going to work in making my language more like TypeScript and removing parts that I don't like from the original Lua source code base to improve speed and game development time (in example native vectors, matrices, classes, mem-arrays, etc).
ORIGINAL POST:
I found Love and decided to use it for prototyping but no matter how hard I tried Lua always feel weird for me, not in the core I mean, Lua is a beautiful language, but is only that I prefer C-like languages, so I decided to change the syntax of Lua and integrate it with Love for a personal project of mine.
Right now the virtual machine has not changed but I suspect changes are likely in the future.
By now most of the changes were done in the Lua lexer and parser.
The repository is in : https://bitbucket.org/ex/love
This time only windows supports due to my laziness (sorry). Support of other platforms must be only a matter of updating the respective projects.
By default the executable loads the "game" folder where my simple tetris clone port is located:
I'm preparing a post with more information but in resume the main differences between Killa and Lua are:
- Killa (moon in Quechua) is a language based in Lua 5.2 (think in Lua with a JavaScript-like syntax)
- Killa requires variable declaration (no more silent typo errors)
- Local variables and local functions are default, global symbols require the "public" keyword.
- Array tables start with index zero (no 1, so Dijkstra is finally happy)
- JavaScript like blocks: for, while, do. (missing switch)
- Ternary operator: (x != null)? doThis() : elseDo()
- Assignment operators: +=, -=, *=, /=, %=
- Use "this" instead of "self"
- Use "::" instead of ":" due to JavaScript labels and gotos. This can change in the future, I want to get rid of it and use default methods for objects.
Also Killa is not JavaScript, because no matter how much flair JavaScript is getting right now, it has very horrendous parts, so I was aiming for the "beautiful parts" (TM)
- Blocks require the braces, they are not optional (you'll have to type two extra characters now, the madness)
- Killa require variable declaration, the "global" symbol is required to access global objects.
- Lua variable scope (no JavaScript hoisting, no need to declare everything at the beginning of functions and must declare before use)
- No arrays (by now) only Lua tables
- No switch neither exceptions (by now) also the prototype mechanism is missing (and I don't think I'll add it later)
- No ++ -- operators (they are not coming, many reasons, most important I'm not that smart to decipher quickly the one liners I have seen in real life)
- Lua Multiple assignment and return values
- Lua coroutines
- Lua powered for fast embedding and small footprint (this rocks)
There a lots of things I want to add to Killa (arrays, classes, vectors, matrices, etc) but I think this version is already in a point to make it public, and hopefully find users interested on it.
Thanks!
I'm working in the 0.3 version of my language, making Killa a bit more JavaScript-like
updated the latest version with a port of Notch's minecraft4k.js demo: http://jsdo.it/notch/dB1E
The code is pretty much similar to the JavaScript one, so I think I'm getting closer where I wanted:
https://bitbucket.org/ex/love/raw/7fe5e ... raft4k.kia
however the performance is poor compared with Canvas and Flash due to the time spent going from the script side to the C++ side,
Flash has a Bitmap data structure that helps a lot, I'll see what I can do for Love-Killa, using shaders for everything is not my thing,
I want this engine to be used by kids
Also because playing with pixels on the screen was very fun and the foundation of the Flash 3D engines before Stage3D.
For Windows there is a pre-built executable. If you need more details, please comment here.
UPDATE:
Hello, I've updated the engine to use the latest version (0.2) of my language Killa. Some highlights:
- Bitwise operators. They are implemented as VM opcodes and are one order of magnitude faster that Lua 5.2 bit32 library functions.
- Many bug fixes and little improvements like:
- Python-like multiline strings
- All the string and table functions are now using index base 0 instead of 1. Test scripts added.
- Fixed bugs with references and compound operators.
Overall this release is a lot more stable than the initial release, I have been using Killa to solve Project Euler problems:
http://elrinconde-ex.blogspot.com/2012/ ... ed-in.html
I was able to beat Python in performance using bitwise operations:
http://elrinconde-ex.blogspot.com/2012/ ... t-lua.html
There is minimal documentation in the Github wiki but it needs lots of work. I'll work on that later, I'm just adding samples and test cases by the moment, but you are free to ask anytime.
About the future, I'm going to work in making my language more like TypeScript and removing parts that I don't like from the original Lua source code base to improve speed and game development time (in example native vectors, matrices, classes, mem-arrays, etc).
ORIGINAL POST:
I found Love and decided to use it for prototyping but no matter how hard I tried Lua always feel weird for me, not in the core I mean, Lua is a beautiful language, but is only that I prefer C-like languages, so I decided to change the syntax of Lua and integrate it with Love for a personal project of mine.
Right now the virtual machine has not changed but I suspect changes are likely in the future.
By now most of the changes were done in the Lua lexer and parser.
The repository is in : https://bitbucket.org/ex/love
This time only windows supports due to my laziness (sorry). Support of other platforms must be only a matter of updating the respective projects.
By default the executable loads the "game" folder where my simple tetris clone port is located:
I'm preparing a post with more information but in resume the main differences between Killa and Lua are:
- Killa (moon in Quechua) is a language based in Lua 5.2 (think in Lua with a JavaScript-like syntax)
- Killa requires variable declaration (no more silent typo errors)
- Local variables and local functions are default, global symbols require the "public" keyword.
- Array tables start with index zero (no 1, so Dijkstra is finally happy)
- JavaScript like blocks: for, while, do. (missing switch)
- Ternary operator: (x != null)? doThis() : elseDo()
- Assignment operators: +=, -=, *=, /=, %=
- Use "this" instead of "self"
- Use "::" instead of ":" due to JavaScript labels and gotos. This can change in the future, I want to get rid of it and use default methods for objects.
Also Killa is not JavaScript, because no matter how much flair JavaScript is getting right now, it has very horrendous parts, so I was aiming for the "beautiful parts" (TM)
- Blocks require the braces, they are not optional (you'll have to type two extra characters now, the madness)
- Killa require variable declaration, the "global" symbol is required to access global objects.
- Lua variable scope (no JavaScript hoisting, no need to declare everything at the beginning of functions and must declare before use)
- No arrays (by now) only Lua tables
- No switch neither exceptions (by now) also the prototype mechanism is missing (and I don't think I'll add it later)
- No ++ -- operators (they are not coming, many reasons, most important I'm not that smart to decipher quickly the one liners I have seen in real life)
- Lua Multiple assignment and return values
- Lua coroutines
- Lua powered for fast embedding and small footprint (this rocks)
There a lots of things I want to add to Killa (arrays, classes, vectors, matrices, etc) but I think this version is already in a point to make it public, and hopefully find users interested on it.
Thanks!