• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

vrJASS

Status
Not open for further replies.
Level 10
Joined
Sep 19, 2011
Messages
527
vrJASS Language

UyuRc3b.jpg

What is vrJASS?
A just-for-fun programming language which compiles down to JASS (Warcraft 3). It aims to improve and replace the beloved vJASS.

What? x2
An update to vJASS which tries to solve its flaws.

I want to try it! - I need a manual
https://github.com/Ruk33/vrJASS/wiki

Last version
https://github.com/Ruk33/vrJASS/releases

Like SublimeText?
Here, a linter: https://github.com/Ruk33/SublimeLinter-contrib-vrjasslint

TODOs
  1. 80%-100% (I'm planning not to implement a few features, like function interfaces, but if anyone can/want-to code it, will be welcome) compatibility with vJASS
  2. Improve debug messages
  3. Fix (module) initializations (implemented as abstract classes)
  4. Improve OOP (type-safety, attributes initialization, etc.)
  5. Anonymous functions
  6. Free variable definition
  7. Add operators +=, -=, *=, /=
  8. Improve/add loops
  9. Null/Empty string/0 Conditional (null->false, "" -> false, 0 -> false)
  10. Auto-null local handle variables Optimizers do this already
  11. Return array Simply use structs
  12. Allow end as alternative to endfunction, endmethod, endloop, etc.
  13. Hooks (before/after)? Delegated to cJASS
  14. Alternative C-like syntax Delegated to cJASS

Green -> Done

When is it gonna be ready?
It already is on an stable version!

Where can I see the progress/code?
https://github.com/Ruk33/vrJASS

How can I help you?
If you know Java or Antlr4 you can check the repository and send me pull requests (don't worry if you don't know too much about them, I'm new too!). If you don't know these languages, let me know your suggestions, I'm open to them :)

So there will be no changes for the final-user (you), it will be like coding with the actual vJASS in my current setup in Newgen without any weird stuff, right?
Kinda. Yes, it is gonna be the same syntax, same features (excepting just a few that no one uses) but with a few and hopefully useful new features like better error messages, free variable definition (not only at the beginning), new loops, etc..

Few examples

Anonymous functions
JASS:
call TimerStart(..., function takes nothing returns nothing
    local timer expiredTimer = GetExpiredTimer()
    // ...
endfunction)
Free variable definition
JASS:
function foo takes nothing returns nothing
    call TimerStart(...)

    if (...) then
       // ...
    endif

    local unit bar = CreateUnit(...)
endfunction
Operators +=, -=, *=, /=
JASS:
local integer i = 5

set i += 5 // same as set i = i + 5
set i -= 5 // same as set i = i - 5
set i *= 5 // same as set i = i * 5
set i /= 5 // same as set i = i / 5
Improved loops
JASS:
while (true)   
    if (shouldSkipThisIteration) then
        continue
    endif

    // ...

    if (isOver) then
        break // same as exitwhen true
    endif
endwhile
Null/0 conditional
JASS:
local unit u = null

if (u) then
    // unit isn't null
else
    // unit is null
endif

local MyCustomStruct instance = ...

if (instance) then
    // instance exists (allocated)
else
    // instance does not exists (not-allocated)
endif

What does vr mean?
Pick the one you like the most:
  • Beer (default), because everyone loves beer
  • Vexorian r$~%d-newbetterversionftw
  • Vexorian Ruke

Greetings.
 
Last edited:
Level 12
Joined
Mar 13, 2012
Messages
1,121
If you want to do this not only for fun but also for other people to use it, I can name you at least ten wc3 related projects which would help map making 100x more.

No, lets have vJass, cJass, pJass, wurst, vrJass, some stuff Nestharus is building and others.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
vJass stands for very jass doe. And function interfaces are like the second best feature of vJass. If you want to improve vJass you should use the implementation of Wurst for function interfaces. And maybe change them to make em easier to use. There are others things i don't agree with but a second implementation of vJass would be really cool tbh. Having something like an compilation server for real time syntax checking.

Anonymous functions are an interesting topic itself. Am i allowed to close over scoped variables? If yes, how would the memory be managed?

Also it's always nice if people confuse what pjass actually does :clol:
On the other hand the point still stands: wc3 would benefit from other things more than another language. But again, a second implementation is something i'd look forward to. Don't be discouraged.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
-test to which degree the sc2 wc3 hq models can be ported to wc3 and create one big download with the ported resources that users only have to put in their wc3 folder.
-help further developing JNGP
-help releasing Sharpcraft (the right new natives would be gold for wc3 modding)
-help releasing WarCom
-package everything together with JNGP to have all tools in one place.
-write good informative tutorials for those things and package them also with the tools, currently users have to dig for everything.
-research in one of the dozens of subcategories of wc3 where not everything is known. E.g. grab Whireshark, dig in the network code of wc3 and write a comprehensive guide about it and how camera, selection, commands etc are synchronized to the host. Or try to extend the fogstate bug, research its and other similar functions memory accessing patterns, maybe we can one day access hidden stuff we currently can't. I could give a lot more specific examples here. The return bug, ingame texture swapping and many more are all founded on small insignificant discoveries summing up to something bigger.
-one big comprehensive guide to known things in wc3 would help a lot. Every day there are questions and people answering do sometimes just guess or quote something false, a big verified guide would help there.
-lend your help to http://tft.w3arena.net, as this seems to be the place where wc3 is played in the next years.
-travel to Blizzard HQ and stalk them to release a good 1.27 patch.

nice if people confuse what pjass actually does
Don't care if its a syntax checker, it had the name "JASS" in it :at:.
 
Level 6
Joined
Jul 30, 2013
Messages
282
vJass stands for very jass doe. And function interfaces are like the second best feature of vJass. If you want to improve vJass you should use the implementation of Wurst for function interfaces. And maybe change them to make em easier to use. There are others things i don't agree with but a second implementation of vJass would be really cool tbh. Having something like an compilation server for real time syntax checking.

Anonymous functions are an interesting topic itself. Am i allowed to close over scoped variables? If yes, how would the memory be managed?

Also it's always nice if people confuse what pjass actually does :clol:
On the other hand the point still stands: wc3 would benefit from other things more than another language. But again, a second implementation is something i'd look forward to. Don't be discouraged.

cjass lambda, bit fiddly to get started with but once you get used to the new syntax its very useful + u can use it on top of vanilla vjass. (u give up modules for cjass tho which is a bit sad, but you can replace those with macros or use a //nocjass section so i tend to live with it, in short, its just useful enought to live with all the pains..)

Also Nestharus is working on another alt-vjass language called xjass, might be a good idea to get in contact and help him in stead.

oh and dont forget.. all the issues he's dealing with (eg usable in existing maps? existing codebase? vjass libs?) you must deal with too.
 
Level 10
Joined
Sep 19, 2011
Messages
527
Also Nestharus is working on another alt-vjass language called xjass, might be a good idea to get in contact and help him in stead.

I was kinda helping him, but then I got a call and had to leave for some medical exams. He probably already finished what we could both benefit from so now we follow different paths (I want to update/rebuild-from-scratch vJASS, he doesn't want to know anything related with it, he really hates vJASS xD).
 
Level 6
Joined
Jul 30, 2013
Messages
282
well acording to: https://sites.google.com/site/nestharus/jass
vjass and zinc is on his road-map.

anyway he will implement a whole stack and seems like he put a lot of emphasis on modularity. even if he wont poke vjass with a long stick you can prolly save a lot of effort by just making another frontend for his system. also will help with interoperability..
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The reason why I no longer support vJASS is because the underscore symbol is used as the scope resolution operator. This is a symbol that is valid for signatures. This makes it ambiguous between whether something is actually a scope resolution or part of a name.

There is one great example that illustrates this, and even though it is perfectly valid code, it will throw a syntax error.

JASS:
scope a
    public integer b
endscope

globals
    integer a_b
endglobals


There are other reasons I no longer support vJASS at all as well. The language is inherently flawed, and so it should simply be scrapped ; ). When I also think about it, there is no real way to translate vJASS into xJASS unless no scopes or libraries are used whatsoever.


Ruke did initially help with the symbol table, but he mostly defined prototypes from a design document ; ). Well, he also wrote some broken code : D. He didn't end up using the symbol table at all and instead wrote his own from scratch.


If you would like to see any of these projects sooner, xJASS or vrJASS, you can always help out ^)^.
 
Level 6
Joined
Jul 30, 2013
Messages
282
When I also think about it, there is no real way to translate vJASS into xJASS unless no scopes or libraries are used whatsoever.

well..
that kind of makes 99% of all existing code out there useless and also rules out your new language from ever being used on a legacy product.

and i was kind of hoping to get to upgrade to sth better than the broken vjass/cjass combo we have atm. so sad.. :'(
 
Level 10
Joined
Sep 19, 2011
Messages
527
Ruke did initially help with the symbol table, but he mostly defined prototypes from a design document ; ). Well, he also wrote some broken code : D.

I told you, it was to give personality to the project ! (?

He didn't end up using the symbol table at all and instead wrote his own from scratch.

The reason was because I was needing something way more simpler than what you were building.

Let's first see what can I bring here, so far so good.
 
Level 10
Joined
Sep 19, 2011
Messages
527
Well guys, this is it for me. In 4 days I will be off for two (maybe more) months (in another city!) because I got a job (at the army) :D

So far, this thing is pretty good, it supports several features and perform checks on them (for example variable types, scope visibility, etc.). You can see all of the progress on the commit log.

All of the features have unit tests so it is pretty solid and quite easy to find bugs.

Lacks quite a lot on documentation but since it has tests it should be easy to catch up if anyone want to continue it.

See you people :), have a nice day.
 
Cool Idea

I am thinking of creating a third party language to compile into JASS as well! Though, this is based strongly in the C++ syntax, rather than the JASS syntax. The two tabs contain J++ code and what it would be translated into in JASS. Yes I realize that there can be an optimization for the reuse of the unit's life. What are people's thoughts about that? Or are we still attached to the JASS syntax?

J++

JASS


C++:
bool DamageUnit(unit Target,float Damage){
    if(Target.life<=Damage){
        Target.explode=true;
        Target.kill();
        return true;
    }
    Target.life-=Damage;
    return false;
}
JASS:
function DamageUnit takes unit Target,real Damage returns boolean
    if GetUnitState(Target,UNIT_STATE_LIFE)<Damage then
        call SetUnitExploded(Target,true)
        call KillUnit(Target)
        return true
    endif
    call SetUnitState(Target,UNIT_STATE_LIFE,GetUnitState(Target,UNIT_STATE_LIFE)-Damage);
    return false
endfunction
 
Level 10
Joined
Sep 19, 2011
Messages
527
Zeather, if you are going to be doing this, use my Symbol Table : ). I've been working hard on it and it's really good. It's my proudest accomplishment to date ^_^.

It can fully model the environment of a program. This means that it's suitable for both interpreters and compilers.

after using the visitor implementation, i don't know if a symbol table is really that useful.
 
Level 10
Joined
Sep 19, 2011
Messages
527
I'd love to know how, since a symbol table is used to do exactly that. A stack of HashMaps is still a symbol table. Antlr4 examples use a symbol table too.

oh you are right, a symbol table is commonly implemented with a hashtable according to wikipedia.

probably when the project gets bigger i will need something like your implementation, but so far a simple hashtable fits perfectly.
 
Gross, Java. I use regex to pull the tokens from the source file into and will shove it into a ticker tape reader. That's all this is; a turning machine. It can run through a file rather quickly as well I have looked at antlr4. I feel that it'll be a bear to integrate as I have needed it before but couldn't use it for some reason.What is so bad about using regex to pull tokens from the file stream?
 
That is indeed nice, but I'm not interpreting any tokens as that stage, errors or otherwise.
C++:
#include <iostream>
#include <regex>
using namespace std;

int main(){
    string Data="Herro World!";
    string::const_iterator Position=Data.cbegin(),End=Data.cend();
    regex Syntax("^.{3}"); // Grab 3 characters from the start of the string.
    smatch SyntaxMatch;
    while(Position<End){
        if(regex_search(Position,End,SyntaxMatch,Syntax)){
            cout<<'"'<<SyntaxMatch.str()<<'"'<<endl;
            Position+=SyntaxMatch.length();
        }else break;
    }
    return 0;
}
/* Output:

"Her"
"ro "
"Wor"
"ld!"

*/
 
Level 6
Joined
Jul 30, 2013
Messages
282
for real.. you should NOT be implementing your own parser from zero..

use an existing one if at all possible or it will take you ages and you'll end up with some disfunctional unmaintainable mess guaranteed.. :'(
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
consider C++. The lexer needs to know types of lexems it reads, and the parser needs to support infinite look-ahead. Thats really hard, if not impossible to build with plain regex.

Also even the current Vexorian's JassHelper fails immensively, even with Byson/Yakk combo, because he treats function calls inside string as function calls, and with optimizations(inlining) it will actually fatal out with "out of memory, fuck you" error(http://www.hiveworkshop.com/forums/...per-crashes-perfectly-compilable-code-264740/)
 
Level 10
Joined
Sep 19, 2011
Messages
527
Zeatherann, please use Antlr4 ^)^.

By using Antlr4, you'll be able to use my awesome symbol table, which supports things like function overloading, vJASS typecasting with proper type detection (only legal casts), very smart macros (like modules), generics (o-o), and so on.

and if you order right now you will get a free burger and $200 to spend on amazon, what are you waiting for?, order now!

i'm sorry, couldn't resist
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
jasshelper doesn't use bison/yacc. pjass uses flex/bison though. also scanning and parsing a sensible language like jass should be the easiest part.
 
Level 10
Joined
Sep 19, 2011
Messages
527
Well how to use this shit (antlr) xd..... I must have python?
you can use antlr4 in java, c#, python and javascript. go to the official page www.antlr4.org

new updates, so far vrjass can/offers:

parse common.j
parse blizzard.j
check for already defined functions
check for already defined variables
check variable/function types
beta class support (i think more tests are required)
auto prefix variables and functions (library-name_function, etc.)
auto sort function (foo defined, bar defined, foo calls bar, then bar will be placed before foo) (it will work even for mutual recursion)
check for function arguments (too many, too few, incorrect type)
check for function return type
merge globals block into one
check for constant variables
use integers as boolean expressions (0 -> false)
free local variable declaration
compound operator (example: i += 5 -> i = i + 5)
beta native declaration (i want more tests)
beta textmacro support (i want more tests)

again, all of the features are being automatically tested so it should be pretty solid.
 
Level 10
Joined
Sep 19, 2011
Messages
527
i'm exited as shit with this project, i'm not gonna lie.

here i attach the first console compiler.
to use it, simple type

java -jar path/to/vrjassc.jar file1 file2

the output will be writed to output.j file (which will be created from where you execute the jar file)

here is a demostration:

JASS:
function isEven takes integer i returns boolean
	if (i) then
		set i -= 1
		return isOdd(i)
	else
		return true
	endif
endfunction

function isOdd takes integer i returns boolean
	if (i) then
		set i -= 1
		return isEven(i)
	else
		return false
	endif
endfunction

compiles to

JASS:
globals
integer vrjass_c_isEven_i
boolean vrjass_c_isEven_return
endglobals
function vrjass_c_isEven takes integer i returns boolean
set vrjass_c_isEven_i=i
call ExecuteFunc("vrjass_c_noargs_isEven")
return vrjass_c_isEven_return
endfunction
function isOdd takes integer i returns boolean
if (i)!=0 then
set i=i-1
return vrjass_c_isEven(i)
else
return false
endif
endfunction
function isEven takes integer i returns boolean
if (i)!=0 then
set i=i-1
return isOdd(i)
else
return true
endif
endfunction
function vrjass_c_noargs_isEven takes nothing returns nothing
set vrjass_c_isEven_return=isEven(vrjass_c_isEven_i)
endfunction

ugly as shit, but functional (if not wrong, cant test it though xD)

not very happy with the performance though, it took 11-20~ secs to parse common.j+blizzard.j (total of 12646 lines of code, including comments), so i'm gonna try to cache them in some way.

is that like common vjass/vrjass thing or compat or non-compat?
i'm sorry, didn't understand your question
 

Attachments

  • vrjassc.zip
    1.6 MB · Views: 80
Last edited:
Level 10
Joined
Sep 19, 2011
Messages
527
One global for each parameter and return value, plus a second proxy function that's called with ExecuteFunct() is just plain horrible. It'd be better to run it though a EvalTrigger() , though that's still not optimal.

those are really tiny optimizations dude, even vexorian does the same thing except for ExecuteFunction (he uses a trigger) (i will keep those optimization to the last though), on the other side the advantages are huge (maybe with 1 function you don't notice, but when you have several function like these this is very good). also, keep in mind that this feature is supported and used by vjass so it must be included in vrjass.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
i'm exited as shit with this project, i'm not gonna lie.

Do you mean "excited"? Or "exited" == stop work?

yep, i assume it was because it is running all the checks (return types, variable types, etc.)

How would you parse a file without performing all required checks? Even then, 20 seconds is way too slow, there must be something wrong...

although i would like to know the line code count of some large maps.

I have an old version of a quite big map project I participated in some time ago. Line count is about 30000 (excluding common.j and blizzard.j, but including quite some empty lines).

EDIT: Just checked, line count of non-empty lines is about 24000.
 
Status
Not open for further replies.
Top