Discussion New Language - Discussion

Nestharus

o-o
Reaction score
84
kingkingyyk3, if you're going to be like that with spaces, a better alternative would be blocks. Blocks are a lexical scoping concept and are actually used by some languages over the use of namespaces. Blocks would actually be more appropriate for JASS as well considering it can't point to namespaces the same way other things do : ).

http://www.inform-fiction.org/source/tm/chapter4.txt

4.2 Level 1: lexical blocks and buffered input


Furthermore, let a user pick w/e syntax they want with code blocks and let them output to w/e language they want ; ). For example, you might want to write JASS syntax in Galaxy or C++, who knows, lol ;P.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
Namespace makes no sense imo, maybe instead of scopes you have namespace, but when it comes to namespaces requiring other namespaces, that's icky. Library makes a lot more sense then namespace.


What would be nice, is a nameless scope:

JASS:
scope
    private constant string THE_GAME = "you lost"
endscope

scope
    private constant string THE_GAME = "also cocks"
endscope


I never saw the point of naming a scope anyway, it's not as if the name is even used (unless you are trying to defeat the purpose of the scope).


also free global declaration plz kthx
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Well, good news.
I got an already functioning parser built in Python, so I'll be doing this in Python again (inability to decide a language FTW?).

Anyway, I'm going to spend the next few days learning the code does exactly. It's only 200 lines long, so it shouldn't take long. I just need to figure out how it does everything, and then modify it to suit the needs of the new parser.

(BTW, I didn't steal code. I have permission.)

Oh, also. I'll be using this for Window releases, a simple "chmod +x" on Linux should work, and I have no idea for Mac yet.
 

Vestras

Retired
Reaction score
248
If you want to hear my opinion and haven't already decided on the syntax, I think that you should probably stay as much as possible to the generic Jass syntax and just add new features, maybe changing the syntax a little for faster typing, but now changing it drastically like cJass did.

Some of the features I would add:
  • Multiline expressions (Like Visual Basic _)
  • Free global/local declarations
  • Free function declarations
  • Remove [ljass]then[/ljass] and other useless keywords
  • Add oneline if statements
  • DO NOT ADD MULTILINE COMMENTS - IMHO they're the worst way ever to write comments
  • Add functionality from other languages, such as foreach and while.
  • Possibly add LINQ (lol)

An example of how I would build the syntax up:
JASS:
library Message
    import AnotherLibrary
    import LolLib

    private constant int MaximumIndex = 8000
    private constant string DefaultString = "Sample"

    function Message(string message): bool
        bool result = false
        
        if (true)
            DisplayTextToPlayer(Player(0), 0, 0, "lol")

        int index = 0
        while (result == false)
            DisplayTextToPlayer(Player(0), 0, 0, "Spamming")

            if (index == MaximumIndex)
                result = true

            index++
        endwhile

        return result
    endfunction

endlibrary
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
I like the import keyword. I'm not sure about how your doing blocks though.
Different IDEs and such use different tab lengths, so if I use indentation based blocks, it may cause errors.

However, the source I'm basing it on already has indentation-based syntax (from what I was told), so it wouldn't be long to implement it.

I was originally planning on "{ }" blocks though.
 

Rllulium

New Member
Reaction score
10
I like the import keyword. I'm not sure about how your doing blocks though.
Different IDEs and such use different tab lengths, so if I use indentation based blocks, it may cause errors.

However, the source I'm basing it on already has indentation-based syntax (from what I was told), so it wouldn't be long to implement it.

I was originally planning on "{ }" blocks though.
Should really not be a need for basing it of indentation. Overall I have to say that I really like the syntax in Vestras suggested. {} Blocks are rather clunky to use in my opinion.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
{} are lame for those which have an AZERTY keyboard (yes only Frenchies like me :D).
Meh, one day or an other i might buy a QWERTY one anyway.
 
Reaction score
456
> Free function declarations
What?

> Remove then and other useless keywords
, such as endfunction and endif. Easily done with {}. Less stupid keywords the better.

> Add oneline if statements
Never. Such beasts should be banned.

> DO NOT ADD MULTILINE COMMENTS - IMHO they're the worst way ever to write comments
Do not listen to him!

> Add functionality from other languages, such as foreach and while.
Foreach? How :D
 

SerraAvenger

Cuz I can
Reaction score
234
Priorities: 0[ignore]->10[YESYESYES]

if you want to add classes, please allow us to use an
6method initialize
xor a
static method create

in our structs!
initialize should be called in structs with no explicit static create() method
(or whatever you call them)

3Use real blabla ( real a, real b )
instead of
blabla (real a, real b ) -> real

10Have class interfaces be applied automatically, not explicitely

2return implicitely whenever the last line is a expression of the same type as the return type of the function, eg
real blibb () { 5.0 }

Apart from that, you should go into Zincs direction - I really do like the syntax.

3What you might try to do though is instead of ";" as the only line delimeter, add
Code:
|code that can span multiple lines|
Code:
such that
a +=
5 // INVALID!!!
|a +=
5| // Perfectly valid
That way, instead of having to use ; even where unnecessary, we can use || only where necessary.


BTW:
If you have the time, also add type comprehension such that the compiler can find out the type of a variable by the functions / operations it is used in. This is possible due to the very nature of JASS; In order to have a variable be useful, a native MUST be applied on it somewhere, somehow, which would allow you to get the type.

that way,

Code:
* blublub( * a, * b ) {
 R2I( a + b + 0.0 )
}

would become
Code:
integer blublub( real a, real b ) {
 return R2I( a + b + 0.0 )
}
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
60% done on the actual definition which will explain any special keywords, syntax, etc.
When it's done, I'll post it so everyone can tell me they're input on everything.

I should have it done in a day or two, but I make no promises.
 

Laiev

Hey Listen!!
Reaction score
188
@Lyerae

You're writing it based on what?

Also can you post that site which you'll post the function/etc? :p
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
> You're writing it based on what?

Little bit of everything, modified to be useful in JASS.

> Also can you post that site which you'll post the function/etc?

Explain?
 

Laiev

Hey Listen!!
Reaction score
188
@Lyerae

that with wikipedia and google and idk lol

you have posted the link idk where lol
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Yeah... I have no idea what you mean. Sorry.
I'll read your post again in the morning (it's really late here. 3:35 AM. :/). Maybe I'll understand then.

'Till then, night everyone.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
[LJASS]"%s was killed by %p"%(GetPlayerName(a), GetPlayerName(b))[/LJASS]

[LJASS]// Readability! Yay![/LJASS]
[LJASS]GetPlayerName(a) + "was killed by" + GetPlayerName(b)[/LJASS]
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
[ljass]GetPlayerName(a) + "was killed by" + GetPlayerName(b)[/ljass] is much more readable.
 

Azlier

Old World Ghost
Reaction score
461
What's the point of a continue; keyword?!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top