1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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:
    25,612
    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:
    25,612
    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