1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Tool] GalaxyParser

Discussion in 'StarCraft II Modding' started by xD.Schurke, Mar 20, 2011.

  1. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    (Hope it's the correct Forum, since no script/tool forum for sc2)

    Hey guys,

    I want to present a small project I'm working on, for all u guys who don't like working with the SC2 Script-Editor etc.

    First I should present my plan:

    It consists of 3 steps:

    • Step1: Programm a proper GalaxyParser (This is the step I'm currently working at)
    • Step2: Programm a properGalaxyXParser (GalaxyX is the custom language I'm working on, but priority is the GalaxyParser) http://userpage.fu-berlin.de/timoh1991/manual.html (Sorry, only my userpage provided by my university)
    • Step3: Releasing a all mighty Galaxy IDE (EditorX...the part where I assume to need help).
    So since I'm at step 1, I can present to you the first version of the GalaxyParser (0.1.0)!



    What the parser actually does:
    • SyntaxCheck/SemantikCheck
    • Includes the includes if wanted (see in How-To)
    • Information about allocated Memory

    The whole thing is written in Java with the help of ANTLR (www.antlr.org).

    FAQ:
    How do I use the parser?
    • U need the current Java JRE to be able to run this programm.
    • use commandline: java -jar "path of parser" "path of galaxy file" "options"
    • current available options:
      -o doesn't close commandprompt instantly
      -i imports the includes (File-Directories are currently not supported)
    • be happy!

    How can I help?

    What else can I do?
    • If u have tipps/wishes, post them . I try to add them.

    Update Changelog

    v0.3.0
    - Added a new feature which informs the user about the total memory his script allocated (Used by Variables)
    - If there is only 10% of memory left the parser will start throw a warning that the user is close to the limit

    v0.2.1
    - fixed a bug with the TreeParser (Struct variable types, couldn't be obtained when struct was saved in a an array)
    - debug text polished for putting functions/variables into the HashMap

    v0.2.0
    - full type checking added
    - debug stuff is now shown with "DEBUG:" prefix
    - Parser now works slightly different: before it was like: lexer -> Parser -> Type checking
    Now it's more like a real compiler: Lexer -> Parser -> AST -> TreeParser -> Type Checking
    - the contained native galaxy files are slightly different then the original (only so that the parser has less to do, I've written a
    small programm which cleans the lib_ntv file and the AI file... to get rid of function bodies and marking them as natives

    v0.1.1
    - added new parser option (-d for debug: parser shows some stuff ONLY PARSER DEBUG:
    e.g. when a local variable or global is created (text in german))
    - added first variable check (checks if a variable is allready defined, if so it throws an error.)
    (DOES NOT CHECK IF A VARIABLE IS DEFINED, for variable assignment or expressions, this will be the next step in 0.1.2)
    - due to variable check, performance dropped a bit, but still good :)...meh


    v0.1.0

    - first release
     

    Attached Files:

    Last edited: Mar 26, 2011
  2. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    new version 0.1.1
     
  3. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    new version 0.2.0

    v0.2.0
    - full type checking added
    - debug stuff is now shown with "DEBUG:" prefix
    - Parser now works slightly different: before it was like: lexer -> Parser -> Type checking
    Now it's more like a real compiler: Lexer -> Parser -> AST -> TreeParser -> Type Checking
    - the contained native galaxy files are slightly different then the original (only so that the parser has less to do, I've written a
    small programm which cleans the lib_ntv file and the AI file... to get rid of function bodies and marking them as natives
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,100
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Too bad you need to paste the script into the galaxy editor. That still limits you to 2 functions before the computational time needed exceedes a super computer due to bad highlighting code.

    Unless you do some complex include thing which would affect maintainability.
     
  5. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    That's true. A solution could be generating a MapScript.galaxy file, which could replace the original.

    At the moment the 'include' tag can be used for custom scripts, at least I hope so... didn't test it

    Edit: Btw. the actual Agenda for GalaxyX can be found here: http://userpage.fu-berlin.de/timoh1991/manual.html (Sorry, only my userpage provided by my university)
     
    Last edited: Mar 25, 2011
  6. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    new version 0.2.1

    v0.2.1
    - fixed a bug with the TreeParser (Struct variable types, couldn't be obtained when struct was saved in a an array)
    - debug text polished for putting functions/variables into the HashMap
     
  7. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,100
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Have you rememebered to add some form of warning for people allocating too much struct/array space?
     
  8. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    I wanted to track the memory allocated by global/local variables, but didn't thought about a warning :D

    thanks for the tip

    Edit: the limit for script was 2^21 bytes, but during the time they changed some stuff, so I don't really know the limit. Have to test it^^
     
  9. xD.Schurke

    xD.Schurke

    Joined:
    Feb 22, 2006
    Messages:
    948
    Resources:
    5
    Maps:
    1
    Spells:
    4
    Resources:
    5
    new version 0.3.0

    v0.3.0
    - Added a new feature which informs the user about the total memory his script allocated (Used by Variables)
    - If there is only 10% of memory left the parser will start throw a warning that the user is close to the limit