NixScript – A C-style Monkey typeless scripting language
This is a pretty eventful post. So after taking some pointers and such from a module called MiniC, I finally started understanding how to really build a scripting language. Up to this point, I had extremely limited experience with parsers and didn’t really understand them very well. After playing around with MiniC for some time and realizing its, for lack of better words, odd expression handling and for whatever reason it’s crash-style of handling errors, I decided it’d be easier to write my own script module than to attempt to make MiniC not crash upon getting an error. The result is NixScript, an even more like C-style scripting language. I still consider it in its infancy, but after 5 days, or something like that, of work, I’m very well pleased with the results. Plus, to be honest, I think the other missing features will be in by the end of my work session tonight.
This will be the backend of the objects and such from the game we’re working on. So that way you can mod it and whatnot. I’ll be putting the EBNF out in a bit as well as the Notepad++ UDL and will release some other information pertaining to it.
The language is inspired by Python and C. This is denoted in things like “elseif” being “elif” and “#” being the comments. Here’s an example of what’s working right now (which is pretty basic), but it’s awesome for me!
The first list is the scanner list. Then second list is the parser binary tree. The third thing you see is the calculated results of the virtual machine.
As a last note: Surprisingly, I did not show much of the scripting language’s power off in this picture because I was actually testing the if/elif/else statements at the the time…which were a success!