1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved How and Where does skript convert text into Java bytecode

Discussion in 'Java' started by Gamebuster, Jan 26, 2017.

  1. Gamebuster

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    26
    Likes Received:
    3
    I'm just wondering what class actually converts a skript file into bytecode, and how it actually does so at runtime.

    I was thinking about making something similar to skript for something else, and I just kinda want to know how skript does it to see if it's a better design, but I can't seem to find what class does this.
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    It doesn't. When Skript parses a file, it creates several objects to represent the script and stores it in memory.
    The only JVM bytecode that Skript uses is what's available in its jar (and addon jars, of course).
     
    BaeFell likes this.
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    To expand upon what @Rezz said, Skript doesn't keep a parsed script together. It's broken into parts depending on the events, commands and other features it has.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I see, thanks for the info.
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Snow-Pyon and BaeFell like this.
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I'd be tempted to get a few people together and go through that and make a new Skript. I've made a very basic (and once working), plugin like Skript called Zetox (https://github.com/nfell2009/Zetox), but it's designed completely wrong (parses a script on every event).
     
    Rezz likes this.
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    It would be awesome if there was a project that allowed Skript addons to work on Zetox by having classes with the same methods in Skript.
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Could do it quite easily. Just fake a load of Njols packages and classes.
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Maybe even have a "compatibility" type config for addons, for example if an addon fails to load because it detected a class; have a config option to return false for a specific class.
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/about.html


    I think this is very interesting, I'm actually going to look into this further.
    --- Double Post Merged, Jan 27, 2017, Original Post Date: Jan 27, 2017 ---
    More infos

    http://www.javaworld.com/article/2071821/core-java/build-your-own-scripting-language-for-java.html
    --- Double Post Merged, Jan 27, 2017 ---
    Even more infos

    http://www.drdobbs.com/jvm/jsr-223-scripting-for-the-java-platform/215801163
     
    BaeFell likes this.

Share This Page

Loading...