Solved How and Where does skript convert text into Java bytecode

  • 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!

Gamebuster

Addon Developer
Jan 25, 2017
26
3
3
124
Ur-Anus
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.
 
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).
 
  • Like
Reactions: BaeFell
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.
 
  • Like
Reactions: Rezz
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).
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.
 
Could do it quite easily. Just fake a load of Njols packages and classes.
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.
 
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).

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).

https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/about.html


Java Documentation said:
Although scripting languages are usually interpreted at runtime, they can be compiled into Java bytecode that can then be executed on the Java Virtual Machine

I think this is very interesting, I'm actually going to look into this further.
[doublepost=1485554710,1485554141][/doublepost]More infos

http://www.javaworld.com/article/2071821/core-java/build-your-own-scripting-language-for-java.html
[doublepost=1485554972][/doublepost]Even more infos

http://www.drdobbs.com/jvm/jsr-223-scripting-for-the-java-platform/215801163
 
  • Like
Reactions: BaeFell