Jass++

This weekend I continued reading Bison and Flex documentation and tutorials and added many improvements to my Jass, vJass and Zinc grammar files.
Since Vexorian still hasn’t released a new JassHelper version yet it’s hard to continue development of “Die Macht des Feuers” because I need some of the new features and the new “comment double imports” features is bugged and comments equal file names not file paths.

Thus I felt a little bit bored and started to write my own definition of a cool new scripting language which extends Jass and adds many missing features.
Up to now there’s only a single draft document written in German which already contains most of the important features of this “not-yet existing” scripting language. I called it “Jass++” because as you probably will expect I’m a real fan of this language and it adds some kind of similar features to Jass like C++ does to C.
So first of all I want to argue why I really would like to have my own scripting language with my own compiler although there are already the languages vJass, Zinc, and cJass.
In my opinion cJass has too little features to use it without vJass or Zinc. Using Zinc is the only way to use nice Syntax therefore I would move to Zinc with all of my code if I had more time left.
The real problem is that vJass or Zinc have some features I dislike (e. g. modules, scopes and those unnecessary syntax features) and haven’t some I miss (e. g. real classes, keyword protected, real virtual methods, nested libraries or scopes with requirement which are more like namespaces and can be extended everywhere and real preprocessor if statements). Besides Vexorian doesn’t really fix bugs very fast when people report some.
All in all vJass is not that bad and Zinc fixes its ugly syntax which is of course inherited from Jass but has never been liked by most people but it would be much better to have something like Jass++ with a much nicer compiler which doesn’t show just one syntax error and which of course is cross-platform.
I’m going to use the new Bison and Flex grammar files (for Jass, vJass, Zinc and Jass++) with vjassdoc and revise the class Compiler that vJass, Zinc and Jass++ can be compiled to a map script by using vjassdoc.
Since there are already lots of “parsed object classes” in vjassdoc I will write some new for all kinds of objects of the scripting languages and define some compilation methods for each “Object” child class that they all can be compiled to Jass code.
Creating function prototypes (for executions and evaluations with triggers) should be treated by the “Compiler” class.
I’ve already revised lots of code of vjassdoc, dropped many unnecessary methods and added some new virtual ones which helps me to program much more object oriented. There is a new class now called “List” which is contained by class “Object” and holds all “Object” childs of a specific class like “FunctionInterface” or “Method”.
This replaces the old “Parser” methods which had to filter a specific list or to get specific class data. Now everything is returned by virtual methods and I don’t have to call something like ::initClass() before using a class.
Additionally I added the new compile flag “HTML” which should always be enabled if you want to generate HTML API documentations.
The Gentoo Linux ebuild for vjassdoc should also work correctly now and the cmake files were revised and improved. There isn’t any operating-system specific left since Boost C++ Libraries treat all file-system specific stuff now.

Okay, let’s show you some keywords which should be usable with Jass++:
if, else, switch, case, break, continue, default, while, do and for are common keywords which do have the same meaning like in other programming languages. Probably there won’t be a specific for loop like in Zinc (for (0 <= 1 < 10)).
This is the current list of more language specific keywords: native, init, threaded, debug, template, package, private, protected, public, enum, class, this, self, super, new, delete, copy, init, big, virtual, execute, executewait, evaluate, executions and evaluations.
Instead of structs like in vJass and Zinc, Jass++ only provides classes which are declared by using the keyword "class". The difference is that class members are private by default.
Instead of libraries and scopes Jass++ uses "packages" which can be nested and extended everywhere. Package members can be hidden by using private or protected. Protected can be used to make them accessable for nested packages.
The debug keyword works similar to the debug keyword in Zinc and is equal to a preprocessor if statement which will be discussed later in this web log entry.
enums are like in other languages and can be declared in global scope, packages or classes. The keyword native can be used to declare native types and functions which usually is not needed. Functions declared as "init" are called during the map initialization and mustn't have parameters.
Functions declared as "threaded" can be called by using "execute", "executewait" or "evaluate" and are compiled in custom trigger actions.
The language does also support real virtual methods by using the keyword "virtual" and public/private/protected class inheritance.
Abstract classes and function interfaces aren't defined yet but surely will be the next days.
The keyword "super" links to the parent class (multi inheritance is not allowed) and the keyword "self" to the current class. "this" has the same meaning as in vJass. "new", "delete", "copy" and "init" (has two meanings: this one and map initialization function) are reserved for the for optional class methods. "new" and "delete" are the names of the class constructor and destructor. "copy" is the name of the copy constructor (instance copies can be generated by using copy ). “init” is reserved for a static class initializer method which is exactly called before accessing any class member.
“executions” and “evaluations” can be used on “threaded” functions or methods to get the number of executions or evaluations. The “template” keyword is used for C++ like templates which should be checked by compiler (unlike text macros) but in the end their content is copied like text macros one.
“big” is used when you need more than 8192 different class instances or array members. The compiler should generate a global hash table which saves all member data which allows you to save nearly unlimited members but slows down access speed.
The language does also provide multidimensional arrays (with fixed sizes), a C++-like syntax, static function variables, static class members and methods, a well defined, optional standard library with Jass type wrapper classes etc.
Of course there’s much to discuss (e. g. if big arrays and classes and virtual methods should be implemented by using a global hash table or new array variables etc.) but all in all I think this language would be better than Zinc and vJass. Additionally there will be preprocessors like #if, #inject, #external or #vjass and #zinc which probably would users allow to use vJass/Zinc combinated with Jass++ if some properties are similar and vjassdoc could support this correctly.
At the moment I have huge problems when trying to use Zinc combinated with vJass. JassHelper seems to be not able to treat this correctly.
If you speak or understand German you could read first definition of Jass++ and of course you’re free to give me some feedback.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: