• 🏆 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!

LuckyParser: an abandoned JASS parser concept

Should JassHelper be updated?


  • Total voters
    56
Status
Not open for further replies.
Level 17
Joined
Apr 27, 2008
Messages
2,455
I feel that initializing globals should still be done by the user.

I disagree, i like this part of C, giving a defaut value to global variables, but it's me.

There is some efficiency to gain by not initializing those globals.

Are you serious ? I mean it's irrevelant, especially because it's done only one time and on initialisation

That's part of the reason why GUI variables are so bad because they initialize groups and timers even if you may not want them to.

Heh, GUI by themself is silly, there is a huge difference between having the possibility to use a native or not, and using a constant or not.

And I couldn't find a way to make it NOT initialize arrays, which is silly.

What ?
I was talking about no array globals, though you still could add a mechanism to initialize them, like C or whatever else.
I really don't see the problem.
 
Level 26
Joined
Feb 2, 2006
Messages
1,690
Sorry Bribe but have you ever created something like this. Reading your posts makes me expecting that this won't ever be finished.
You're just planning too much. Please consider how long it has taken until vJass has been almost stable and Vexorian is a real freak!
If you're going to create an IDE AND your compiler which supports an advanced scripting language (JassHelper still uses usual JASS parsers and some parts of its syntax, so it doesn't have to compiler EVERYTHING) you're going to waste your time if nobody helps you to develop your programs. It's not only something about experience in parser/compiler programming it's about simply having not enough time as one single person as well.
 
Sorry Bribe but have you ever created something like this. Reading your posts makes me expecting that this won't ever be finished.

No project is ever finished, end of June is going to be public beta.

Edit:

Planning is necessary. Until I get a syntax that is worth parsing why bother parsing it? The way the language is now is starting to look more and more acceptable.

As I've been transforming my existing vJass resources into Luck syntax it has helped me to understand what should evolve and most importantly how to parse it. Every change I have shown I have it worked out in my mind logically how to implement.

I am not limited the same as Vexorian. He was the first person to really develop a language to compile JASS. As developing the first software program was once a complicated process, so was developing the first JASS compiler. I've learned from Vexorian's work and motivated to see this project get off the ground floor.

It may seem unorthodox to someone who isn't familiar with the way I work, so I apologise if I am mistaken for someone who thinks he's biting off more than he can chew. I think about how to do this all day every day, dream about it, have realistic expectations of it and also have a passion for it.
 
Last edited:

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
It's really nice that you have a passion for programming, that's
how it should be.

But, you konw, i don't get why you want to write a freakin' Editor.
Focus your energy on the Compiler and maybe the optimizer.
There plenty of Editors avaible: Vim, NotePad++, jEdit, GEdit, Kate, TextMate.
It would be easier to just write a Plugin for each.
You know a compiler is a compiler...
If you write your LuckyParser modular enough, it would us allow
rather nice Toolchains.
Code:
	Luck -> clijasshelper -> PJass
And that only for compiling some scripts.
If you want to save a whole map, why not use JH?
Code:
	Luck -> JassHelper -> PJass

And if you make your optimizer a standalone one could use it
for his own language.
Code:
	$language -> LuckyOptimizer -> JassHelper -> PJass
where JassHelper can be used as another optimizer and as tool
for saving the map.

So, if you know how to do it, pls say me how are you going to
parse the idention blocks. I heard one normaly uses a `hack'
in the lexer to accomplish that than in the parser.

And i hope you allow things like this:
Code:
function whatever ...
	return CreateUnit(
		Player(0),
		'hfoo',
		x, y, facing
		)
i.e. ignore indention between parenthesis. It's like in Pyhton, isn't it?
 
i.e. ignore indention between parenthesis. It's like in Pyhton, isn't it?

Sure, I'll support that.

So, if you know how to do it, pls say me how are you going to parse the idention blocks.

I know exactly how I am going to do it, but why would you like me to inform you how I plan to? I can tell you this: tabs will not work, only spaces, and it's four spaces no more no less.
 
Notepad++ with replace tabs w/ spaces, tab to indent 4 spaces and shift+tab to un-indent, I don't see the problem?

You want tabs, fine, but it's going to look ugly in the design to check what's a tab and what's a group of spaces. Sometimes you run into situations where you have two spaces and a tab to complete the remaining two spaces and yikes, that can get really unfriendly and fast.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
I know exactly how I am going to do it, but why would you like me to inform you how I plan to?
You know, forum-conversation'n'stuff. But you can also give me the source...

I can tell you this: tabs will not work, only spaces, and it's four spaces no more no less.
heh, have a look at Haskells Indentation. But this rule more sounds like a technical limitation than a style decision, correct me if i'm wrong.
 
By the looks of things (never worked with Haskell) it doesn't indicate precisely "four" spaces but rather any number of spaces as long as it's somewhat indented. It would really speed up the process to just use a "zap tabs to spaces" functionality that's built in with any good text editor, before asking the parser to compile it, becuase then it just has to count spaces instead of spaces, tabs and a combination of the two.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
It's quite nice. If you look at the code you just see where this code belongs without stupid rules which only allow four spaces.
And it shouldnt be hard to implement.
Code:
my $tab_to_normal_space = ' ' x ($options{tablength} || 4);
# ...
(my $whitespace = $line) =~ s/^(\s+).*$/$1/; #catch all whitespace at the beginning of the line
$whitespace =~ s/\t/$tab_to_normal_space/g; #replace all tabs with normal spaces. maybe there some gotchas when dealing with tabs...
my $length = length $whitespace;
if ($length > $last_lines_length) {
  # entering new block
  # put new block token into tokenstream
}elsif ($length < $last_lines_length) {
  # leaving block
  # put end-block token into tokenstream
} #else still in current block
 
Last edited:
Btw, I think it would be fair if you would put "A special thanks to Vexorian" somewhere in the application :/

And then the people that helped him, yeah I can. And another thanks to those who've contributed to this discussion of a new language parser. Fear not that I will not issue credit where credit is more than due.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
That's one ugly language u hav thar (/^(\s+).*$/).

What would that gorgonic stew look like in a real programming language?

As i said in the comment, i would catch all beginning whitespace, however you would do that.

Code:
>>> import re
find_ws = re.compile('^(\s+).*$')

You ofcourse can also just loop through the line and count/replace whitespace/tabs while you're looping.
 
Perhaps I should get some opinions on this then. Four-space indentation is the most formal way to do it, so what could it hurt by requiring a four-space indent instead of letting people get away with ugly syntax.

A tab should register as four spaces (or vice-versa, depending on your view), meaning I can let tabs mix with spaces. As for the gotcha "1-3 spaces + tab" nonsense, should I leave this up to the user to sort out on his / her own? I would hate having to parse that.

As for the recent thing you wrote, I understand everything except for what is probably the core to make it work in the first place: ^(\s+).*$
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
^ means the beginning of the line
(\s+) captures all whitespace
.* captures all other characters
$ means the end of line.

so s/^(\s+).*$/$1/; means replace everything in the line with the first capture-group (the capture in the first parenthesis), e.g. whitespace.
so $whitespace becomes the captures whitespace.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Use library instead and the keyword "requires (or "uses", "needs"), just because if you don't define the requirements the vJass is parsed in an undertermined order.
(So that's why sometimes jasshelper could consider a public function of a scope as inexistant, juste because of the parsing order)

If only the trigger relative order was kept in each saving of the map, like it's done in the sc2 editor. (blaming blizzard, not Vexorian)
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Use library instead and the keyword "requires (or "uses", "needs"), just because if you don't define the requirements the vJass is parsed in an undertermined order.
(So that's why sometimes jasshelper could consider a public function of a scope as inexistant, juste because of the parsing order)

If only the trigger relative order was kept in each saving of the map, like it's done in the sc2 editor. (blaming blizzard, not Vexorian)
I guess scopes are useless then..
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I guess scopes are useless then..

Depends, for example for a custom spell youd could use a scope, and all codes which are supposed to be used by a triggered spell in library (ofc could be split in as many library you want).
(every library are parsed before any scope)

Or you could also just use all library and no scopes if you prefer explicit requirements.

But let's end this discussion, it's far off-topic, i you want to continue create a new thread for it.

I also recommend to read the whole jasshelper documentation.
 
Similar to Zinc, everything in Luck should be done inside of a library. If it has no requirements, it's the exact same thing as building it in a scope. Why make two keywords when you can just recycle the same one?

Also, it's bad convention that scopes were automatically placed below libraries. This allowed users to get away with making scopes that depend on libraries in order to exist, making it often difficult to track if a scope had any requirements to begin with.

Keeping everything in libraries means people are forced to require libraries.

You know that other trick you can get away with in NewGen, where if you accidentally forget to include a library but get lucky and it gets parsed nonetheless? Yeah that won't work in Luck. The parser will only check the library's requirements, the Common library and any libraries Common requires (currently it only requires Dictionary). So if you forget to include a library, the parser will look no further and throw you a nice syntax error.

There will be some pre-supplied libraries to make your life a little easier, too, and any approved Luck system that's good enough will be able to be required without you having to manually click through a tree of web pages to install it (I will periodically update the parser to come pre-packaged with these systems). So it makes it that much easier to share libraries.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
Now that sounds awesome but hopefully the premade libraries will have some tesh alike function list (notepad++ plugin (sorry might have forgot, it's a long thread)).

So spellmaking won't have any requirements as the useful functions are already there if I got it correct?
 
So spellmaking won't have any requirements as the useful functions are already there if I got it correct?

Timer, group and force recycling are included by default, same with dictionaries, unit indexing, custom events and some other very good scripts (some of which I've never released to the public) so you have many of the key bases covered.
 
Here is what the syntax looks like when properly highlighted:

LuckSyntax.jpg
 
Currently using the Table library you can produce infinite-dimensional arrays via:

JASS:
tab[324][2345][0x2348]['ABCD'][StringHash("Awesome")][GetSpellAbilityId()][GetHandleId(GetTriggerUnit())]

Luck will have the built-in "Dictionary" library that operates quite similarly but with much smarter syntax. Instead of having to typecast handles and strings, it automatically adds StringHash or GetHandleId or if I feel so inclined a "R2I(float * 1000)" call so that even floats can be used to hash a value.

JASS:
d.get(1409).get(24053).get('ABCD').get(3.14159).get(GetTriggerUnit()).get("Hello, world!")

^This is able to parse (if I put in the float hashing thing)
 
Level 3
Joined
Jun 3, 2010
Messages
47
Ah, I look forward to the idea of PHP style array styles.

$password["tooltiperror"] = 'password123'

Oh, and can we have PHP style array declarations? It would fit in nicely with the indent style.

JASS:
string array passwords:
    "tooltiperror" => "password123"
    "bribe"        => "luckyman699"
    "nestharus"    => "ilovebribe11"
print passwords["tooltiperror"] # password123
 
Level 3
Joined
Jun 3, 2010
Messages
47
To be honest i've the feeling it's going to be a mess, you try to implement to much features, and personnaly i'm not a fan of implicit typecasting, mostly because it allows bad coding practices.
The jass is really typed.

I'm sort of agreeing with this guy. This is not the direction I imagined Luck going in, this is becoming a bit of a cJASS messy language.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
I think you need to go backwards a lot with how you're doing this. This should not be "hey, how much can we change JASS" but more like Boa or vJASS, just a fixed syntax.

I kinda agree and kinda disagree.
I was thinking about a WC3-Language long, long time even before this thread started.

Since the target language is Jass we need to 'analyze' Jass (short).
Jass is a static, strict typed language. Since vJass we know it's possible to create custom types and inheritance as a dynamic feature. Modules also give us some dynamic too.

I think the key is to make Jass as dynamic as possible without breaking it.
Jass is static typed. So we can't make our language dynamic typed.
Garbage Collection would probably too slow if implemented in Jass.

Let's look at alternatives. There is for example Haskell which has type-inference (now also available in c# and c++0x).
In short it lets us do things like:
Code:
function a takes integer a, integer b returns integer
    let c=2*a+b #holy shit, no type
    return c
endfunction

#compiles to

function a takes integer a, integer b returns integer
    local integer c=2*a+b
    return c
endfunction
So the compiler guesses the type of c with the context it appears in.

OOP does a good job but it can even be more dynamic with parameters. Same goes for modules. So classes and modules should be parametrized.

Another way to make our language look more dynamic is to allow open classes.
Code:
class Foo
#...
end

class Foo #reopens class
    int bla
    method asdf
    end
end

I have alot more thoughts on a Jass-alternative but these are some ideas
which are possible (and easy) to be compiled into Jass.
 
Status
Not open for further replies.
Top