Discussion New Language - Discussion

This is crazy, I know, but how about:
library MyLibrary


Whoah :eek:

A library's non-private members should be accessed from outside the library via "dot syntax": [ljass]TheLibrary.theMember[/ljass]
Using . syntax for libraries would be a possibility.
But honestly, I'm not really a fan of the name "library". The concept of the library is great. I just don't like the name.
But if you want a generic name, it fails.
That's why i like how vJass handle private/public and "normal" (not private, not public) members.

Hmm, it should work like that only if you specify the member as "public" (like Zinc ?, i don't use it so i don't know)
I personally prefer the .L the most. Not because I thought of it, but because of the simplicity. With an asterik, it would be even better. Perhaps, we will also add in some curvy brackets?

       // Example

     function init takes nothing returns nothing

Honestly, that's a great idea, I just think it would make the syntax too messy, and if it's messy, it's unreadable.

I want to try to make it as readable as possible.
I believe the readability in that syntax would be dependent on in-lining ability. I also suggest you make a feature so that you can swap orders in functions in the script that they are compiled. For example, you have to write functions backwards. Like, if you are using timers, you have to make the actions, then put the periodic above them, and so on. You should make a way to have the order flow better, like this.

 function actions takes nothing returns nothing
     //Some actions
     call SomeTimerFunction(periodic,2.50)

 function periodic
    call BJDebugMsg("blablabla")

In normal JASS, Periodic must be above actions, so that it can be called.
That's something to consider after I make a working version of the parser.

Right now, I'm still trying to decide on the definition of the language itself.
What about systems included into .j files that we import in the archive?

#include "aids.j"

The system in now included.
Oh, I'm defininately doing includes. Probably defines too, since it adds a lot of power to the language.

Maybe if and loop preprocessor commands too.
How would includes work? Would you need to save the libraries in a text file in your directory?
Well, includes are simple.
In the folder which holds the parser (and any files it needs), there will be a folder called "includes". Put a file there, and then when you use the include command on the filename, it looks in that directory.
After that, parses the file as if it were inside of the map itself.
For greater lulz, I have to post this:
lib                                        // Library names? Naw... auto detect everything.
    int TempStore 0                        // global declaration with initial value.
    expose doubleMyInt int start int       // public function doublyMyInt takes integer start returns integer
        start start * 2                    // doubling start. there is no '=' required
        = start                            // return start
    expose setGlobal int to                // expose is like public. but you don't need lib prefixes, conflicts throw errors instead
        TempStore to                       // set TempStore = to
    expose multiplyByGlobal int start int
        = start * TempStore
    expose multiplyThings int a int b int
        = a * b

    expose class IntObj
        .int val                           // nonstatic, has . prefix
        int stackLevel 0                   // static, has no prefix
        type[] stack
        type next
        allocate type                      // private static method returning "thistype"
            if stackLevel = 0              // using a static var is like using a global
                next next + 1              // in fact, they are globals
                = next
            stackLevel stackLevel - 1
            = type[stack]
        expose create int val type         // public static method returning thistype
            type this allocate
            this.val val
            = this
        expose .timesTwo                   // public non-static method
            this.val doubleMyInt(this.val) // uses the other lib
        expose .complicatedTimesTwo
            this.val multiplyByGlobal(this.val)

I called this Ycry. You can't read Ycry. It was a hypothetical JASS extending language which aimed purely at development speed, at the sacrifice of all else. Ironically, after writing the language, I decided how much I loved the readability of vJASS. :p

Sample object allocator/deallocator.
    expose class Object
        type[] recycleStack
        int recycleStackLevel 0
        type lastCreated 0
        expose allocate type
            if recycleStackLevel = 0
                lastCreated . + 1
                = lastCreated
            recycleStackLevel . - 1
            = recycleStack[recycleStackLevel]
        expose .deallocate
            recycleStack[recycleStackLevel] this
            recycleStackLevel . + 1

    expose class Int Object
        .int val
        expose create int val type
            type this allocate
            this.val val
            = this
        expose .destroy
        expose .value int
            = .val
        expose .value= int val
            .val val

// Bad syntax abuse (if I allow things to add onto the end of a line instead):
lib expose class Int Object expose .int value 0
// Compiles to:
library B requires A
    struct Int extends Object
        integer value=0
// XD
On a serious note, I would try writing a better vJASS compiler instead of a new language. And please don't take the above seriously. The only part I like in terms of usefulness is defining static with no prefix, and non-static with a "." (dot). Oh, and I found "=" instead of "return" quite readable. :p

Now shoot me for replying in this thread.
> try writing a better vJASS compiler.

Didn't Vexorian say himself that vJASS itself is flawed?
So why try to improve the parsing of something that's flawed itself?

As for that language, I would seriously consider that as a secondary language for the parser.

Also, I was talking to someone in IRC (not The Helper's IRC) earlier, and they said that all the text related parsing would be 100 times easier in Perl, so I've decided I'll use that. It should only take a day or two to familiarize myself with it, so it won't cut heavily into the development time for this.

And finally, I was trying to think of a name earlier for this new language (and it's parser), and the only thing that I came up with that didn't sound like crap (one thing that popped into my head was "Apple", honestly...), was "Onyx". What does everyone think of that?
Here are my thoughts..

1. External Libraries - Import the library using import.

#include "aids.j"
#include "pui.j"
#include "kt.j"

2. Simple Loops

BJDebugMsg("This will loop 3x") ^ 3

3. Built-in Libraries?
4. Overloading
5. Remove the need to type call/set..
> External Libraries - Import the library using import.

Yes, already covered this.

> Simple Loops.

I like the concept, but not the ^ keyword...

> 3. Built-in Libraries?
> 4. Overloading


> 5. Remove the need to type call/set..

If I can parse it correctly.
As for that language, I would seriously consider that as a secondary language for the parser.
As you can see, it's great for development, and I actually find it kind of readable. Well, if you seriously consider it, I'll re-draft it and make it properly readable with some minimal changes (like an = operator for setting things).

My point was there was a few things you could take, like the "=" for "return", and the "." for non-static instead of the "static" for static. :)

Onyx sounds cool.
> Well, if you seriously consider it

I do, but implementing it into the parser will have to wait until the first language works (so I can fix any bugs related to the first one, without throwing in a whole new pile of possible bugs :D).

> Onyx sounds cool.

Cool. Glad at least one other person thinks it cool. :p
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online


      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.