Recent Releases of byteskript

byteskript - Variable Arguments

This draft supports calling functions with variable arguments. It is mainly designed for calling 'var args' methods from Java libraries.

These are called as regular functions: run myMethod(1, 2, 3) from MyClass

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.37...1.0.39

- Java
Published by Moderocky about 3 years ago

byteskript - References

This release adds (tentative) support for references via functions. References can be used to indicate an object without preventing it from being garbage collected by the virtual machine.

Two types of reference are supported in this version: bsk weak_reference(object) soft_reference(object)

Weak references point to an object but do not prevent it from being garbage-collected. If there are no other (strong) references to it, the object will be cleared during garbage collection and the reference's value will be null. Weak references are useful for pointing to information provided by something else, without having to keep track of when it needs to be disposed (e.g. a reference to a Minecraft Player.)

Soft references also do not prevent garbage-collection, but encourage the virtual machine to hold on to the object where possible (e.g. until memory needs to be freed.) The implementation differs between machines: client java distributions typically hold on to soft references for as long as possible, whereas server distributions will dispose of them more readily. Soft references are useful for caching information that can be re-created but is inexpensive to hold on to, (e.g. a parsed configuration file or json structure.) The value can disappear without warning but typically only when the machine needs to free up space.

The (potential) value can be extracted using: bsk reference_value(reference)

References may be supported at a language level in the future. There is a (tentative) plan to support them when variables V2 is finished.

- Java
Published by Moderocky over 3 years ago

byteskript - Script Unloading

This release adds the ability to load a script with the same namespace as a previously-unloaded script.

What's Changed

  • Fix reloading by @bluelhf in https://github.com/Moderocky/ByteSkript/pull/15

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.35...1.0.36

- Java
Published by Moderocky over 3 years ago

byteskript - Event Task Feedback

This release includes a slew of small quality-of-life adjustments (thank you @bluelhf) and little fixes.

Dispatching an event will now give back a data object with some information and the available futures for all tasks it spawned (suggestion from @kiip1) as well as a way to do something after all have finished.

There is also a fix for a minor race condition that was preventing some Futures from being marked as finished correctly, if the script managed to complete faster than the event was finished being dispatched by the controller.

From now on, most work will be towards fixes, quality and speed improvements rather than new features, preparing for a version 1.1 major release.

What's Changed

  • Change ExprFunctionProperty to use 'of' instead of 'from' by @bluelhf in https://github.com/Moderocky/ByteSkript/pull/7
  • Fix all the things by @bluelhf in https://github.com/Moderocky/ByteSkript/pull/9
  • Fix pattern matching for optional groups by @bluelhf in https://github.com/Moderocky/ByteSkript/pull/10
  • Don't throw unchecked exception in unsafe.setjavafield by @bluelhf in https://github.com/Moderocky/ByteSkript/pull/11

New Contributors

  • @bluelhf made their first contribution in https://github.com/Moderocky/ByteSkript/pull/7

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.34...1.0.35

- Java
Published by Moderocky over 3 years ago

byteskript - Pattern Backtracking

This draft supports pattern backtracking. This will slow down parsing slightly, but it prevents errors where one syntax includes another. An example of this would be maths expressions inside strings like "hello + " + "there".

If the first (wrong) match fails (e.g. "hello and " + "there") then it will backtrack to the last successful pattern and attempt another variant (e.g. "hello + " and "there".)

There may be some potential errors when using the Divide / expression with brackets. Fixing this will require renegotiating how patterns work.

- Java
Published by Moderocky over 3 years ago

byteskript - Class Naming Scheme

This draft updates all syntax to use a consistent naming scheme Effect/Expr/Member/Entry...

Some addons that interact directly with syntax may need to update.

A minor addition for addon creators is the ability to register an operator overload (e.g. String + MyType.) This is registered to the library or the runtime like a converter.

- Java
Published by Moderocky almost 4 years ago

byteskript - Wait For

This draft contains a new wait for %Executable% effect. This is not to be confused with the existing wait %Duration% effect.

The wait for ... effect is designed for creating advanced multi-process code. It runs an executable on a background thread but waits for its completion, preserving the execution order. c-like wait for a new runnable: print "1" wait 1 second print "2" print "3" This behaviour is semi-equivalent to a regular run.

c-like run a new runnable: print "1" wait 1 second print "2" print "3"

The key difference between these two is that the background process can be branched off by cancelling the wait with a wake effect. c-like set {thread} to the current thread wait for a new runnable: print "1" wake {thread} // the wait ends here wait 1 second print "3" print "2"

This is a lot safer than using sleep/wake with a regular run ... in the background since a hidden monitor preserves the happens-before relationship and makes sure the code executes in the expected order.

This draft also covers a minor inconsistency that recycled background processes could keep the thread variables that were previously set.

- Java
Published by Moderocky almost 4 years ago

byteskript - Improved Literals

This draft improves handling for literals and contains some internal updates. It should have very little impact on normal users but will make life easier for library developers.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.28...1.0.30

- Java
Published by Moderocky almost 4 years ago

byteskript - Bridge Compiler Improvements and Unsafe

This draft contains a significant improvement to the bridge compiler, a new function entry and a change to the development model.

1. Feature-previews in Unsafe

A new unsafe function namespace has been added to ByteSkript. This is unstable by design and is guaranteed to change between versions. It is designed to contain first-pass features that may be developed into syntax eventually, or may be moved to the stable and reliable skript namespace instead. Equally, these features may be removed without warning if they do not make it past the trial phase.

Features will now primarily be added to unsafe for one minor version before becoming a syntax.

The unsafe namespace will also contain some dangerous functions for manipulating internals that will live there long-term and will never be developed into syntax due to their native unreliability. (E.g. monitoring all script processes, locking and unlocking the fence on objects.)

2. Explicit Function Parameters

Functions may now have explicit parameter types. This is designed primarily for people interacting with third-party Java libraries, who need to match an exact method signature in order to override it.

c-like function blob(name, age): parameters: string, integer return: boolean trigger: print {name} +"'s age is " + {age} return {age} > 31 In this example, the parameters will accept only a string and an integer argument. See section 3 for more information about type conformity.

It is acceptable to under-provide or over-provide parameter types, in which case the extras will be ignored.

This is currently incompatible with atomic parameters, which must accept atomic variables.

3. Type Conformity in the Bridge Compiler

ByteSkript's bridge compiler is now capable of automatically conforming a type when required. This is part of an effort to seamlessly correct common mistakes without causing trouble for the user.

If a function or Java method requires non-object parameters, rather than simply casting or boxing the arguments, the metafactory will rewrite the code on-the-fly to include the correct call to the type converter. Because the bridge compilation is done on-the-fly with direct insights to the types being used, it will only insert converters where they are needed to maximise the speed of the code.

```c-like function blob(name, age): parameters: string, integer trigger: assert {name} is a string assert {age} is a number

function test: trigger: run blob("hello", "3") // converts "3" to 3 run blob(1, 3) // converts 1 to "1" ```

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.27...1.0.28

- Java
Published by Moderocky almost 4 years ago

byteskript - Improved Inline Section Handling

This draft improves the handling of some inline sections and section headers that store values.

Both catch ... and loop ... in ... can now accept any settable expression instead of just local variables. c-like try: assert false catch {@error}: print "hello" c-like loop {@item} in {list}: print {@item}

These two sections now properly support being inlined, although their inline mode is slightly different from usual. Instead of affecting the remainder of their current block, both the inline loop and the catch will now only affect their current line.

c-like print "start" loop {item} in {list} print "end" // {item} will be the final iterated item

To compensate for this, the function expression now supports a special set mode, where the first provided argument shall be replaced by the set value. This allows a function to be used in both of these inline headers.

c-like print "start" loop function(null) in {list} // the `null` value is replaced by the iterator value // function(...) will be run for each item in the list print "end"

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.26...1.0.27

- Java
Published by Moderocky almost 4 years ago

byteskript - Bug Fixes

Each syntax now has an individual test designed to check that expected behaviour is met. This should improve parse-time stability.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.25...1.0.26

- Java
Published by Moderocky almost 4 years ago

byteskript - Fix Config Closing

This release corrects the closing order for configuration expressions when used as a section header.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.23...1.0.25

- Java
Published by Moderocky almost 4 years ago

byteskript - Type Correction

This draft contains an adjustment to how the type expression parses. Type names will be checked more rigorously to see whether they conform to practical standards. Although this does limit some edge cases of unusual unicode types being used, it will also cut down on the number of expressions being erroneously matched to types.

As we progress towards a stable 1.1 release, the focus will be on improving user experience, warnings and error messages for library developers and correcting bugs.

- Java
Published by Moderocky almost 4 years ago

byteskript - Fix Nested Sections

This version fixes an issue in nested loops that all exit at the same time: bsk if 1 is 1: if 1 is 1: if 1 is 2: // ends here

This also fixes an issue for matching zero-length strings.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.20...1.0.22

- Java
Published by Moderocky almost 4 years ago

byteskript - None

This release adds a special none type name for occasional void functions.

Specifying this explicitly is not typically necessary - the bootstrap compiler handles the return process in most cases. It is the first step in allowing for libraries that need to interact with a Java program (e.g. implementing an interface with a void return method.)

bsk function my_func: return: none trigger: print "hello"

Future releases will have a new entry for specifying exact parameters to make sure the signature conforms.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.19...1.0.20

- Java
Published by Moderocky almost 4 years ago

byteskript - Type Converters

This draft adds the potential to convert between types, using pre-registered converters (e.g. text -> number.)

The syntax is %Object% [parsed] as a[n] %Type%. Example: "10" as an integer or 10.5 as a number. When converting, a direct match is attempted first, after which the first valid conversion will be chosen. This means that when converting a number to a string, ByteSkript will first look for a number -> string converter, after which it will fall back to any that allows the input (finding object -> string.)

Any syntax library may register converters.

- Java
Published by Moderocky almost 4 years ago

byteskript - Extending Types

This draft contains a small adjustment to allow types to extend other types.

This is included only for operating with Java libraries, and is not designed for regular scripts. Type constructors are not currently supported at a language level.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.17...1.0.18

- Java
Published by Moderocky almost 4 years ago

byteskript - Skript Configuration

This draft contains a schema for Skript configuration .csk files. In-memory readers/writers are included, as well as syntax for interacting with these from within Skript files.

The .csk file uses a raw key: value structure. Currently it supports only single-line string values, though in future more complex types (lists, sub-keys, etc.) should be supported.

c key: value my key: my value another key: another value :)

Both line // and block /**/ comments are supported. These are supported at a schema level and correctly attached to the following node.

```c // this comment belongs to 'key' key: value

/* this comment belongs to 'my key' */ my key: my value

// this key // has two comments attached! another key: another value :) ```

Comments survive the loading/editing/saving process.

To use .csk files in Skript code, they can be referenced by literal path. c set {conf} to path/to/config.csk // this loads the data into memory add "key: value" to {conf} // add pattern, for convenience set "key" from {conf} to "value" // set pattern // setting to 'null' is equivalent to deleting save config {conf} // saves the in-memory version to its source file delete path/to/config.csk // deletes the file

For utility, the file may also be used as a section header, which will automatically save it at the end of the section. c set {conf} to path/to/config.csk: add "key: value" to {conf} add "hello: there" to {conf} // config is saved here

- Java
Published by Moderocky almost 4 years ago

byteskript - Debug and Compiler Efficiency

This release adds the bsk debug command to the CLI. Running this will generate a post-parse tree of all scripts. The output debug.txt file is useful for bug reports (or for advanced users tracing parse errors.)

The stream-based compiler has also been made significantly more efficient: rather than reading the entire file into memory, it will be read line-by-line and each line will be discarded once it has passed through the compiler. This will make parsing large scripts significantly more efficient.

Jupiter has been added as a new dependency, for its lazy-iterable capabilities.

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.15...1.0.16

- Java
Published by Moderocky almost 4 years ago

byteskript - Every %Duration%

This release adds the every %duration% scheduler member.

This can be used to set up repeating tasks. c-like every 10 seconds: trigger: print "hello"

These tasks are cancelled when their owning script is unloaded. They also contain a transitive reference to a script, so it will not be automatically unloaded while a task from it is running.

- Java
Published by Moderocky almost 4 years ago

byteskript - Test Mode

This draft contains a test phase that scripts can be run in.

During this phase, more debug information is available along with a test meta-effect. The test effect allows behaviour to be added only in the test phase. When not in the test phase, behaviour will be skipped and side-effects will be quashed.

In the following example, the print-out would be 10 in regular run mode and 5 if run using the bsk test command. bsk set {var} to 10 test: set {var} to 5 print "the variable is " + {var}

- Java
Published by Moderocky almost 4 years ago

byteskript - ByteSkript CLI for Un*x

This draft contains no functional changes.

An install-byteskript.sh bash script is included for MacOS/Linux-based operating systems. When run with permissions, it will install an executable to the /usr/local/bin that provides the bsk command as a globally-available alternative to running the Jar directly.

Moving (or renaming) the ByteSkript Jar will break the link, so the install script will need to be re-run.

While this provides no functional advantage, it makes running ByteSkript significantly easier, since the commands become: sh bsk run [script] bsk jar [name] bsk compile bsk clean

- Java
Published by Moderocky almost 4 years ago

byteskript - Improved Jar Builder

This draft uses Foundation's new jar builder tool to improve Jar creation and make the result more reliable.

Version information is now correctly-available in the Manifest.

- Java
Published by Moderocky almost 4 years ago

byteskript - Multi-process Support

This draft supports the compiler and Skript runtime being used in multiplicity. All resources have been localised, so multiple compiler processes can be run simultaneously. Multiple runtimes may also be started within the same JVM but this is not advised, since it is very easy to bleed resources between them by misusing class-loader or function entry-points.

Some internals have also been tidied up.

- Java
Published by Moderocky almost 4 years ago

byteskript - Thread-safety Improvements

This draft makes some improvements to thread-safety. Running multiple Skript runtimes in the same JVM is now safer, but still not advised. Scripts in the same program can now be compiled simultaneously without issue. This is in preparation for moving to a multi-threaded compiler model.

  • Some internals that are not used by default may be moved to the development kit in the next version.
  • I am looking to move to a smarter dependency-finding algorithm in the next compiler version to reduce the output size.

- Java
Published by Moderocky almost 4 years ago

byteskript - Documentation

This draft includes some rudimentary tools for adding and generating documentation about an element.

Future drafts will use this for helpful error feedback. External tools can use this for generating documentation.

- Java
Published by Moderocky about 4 years ago

byteskript - Improve Internal Class-loading

This draft improves internal class-loading to make libraries more accessible from scripts and avoid using the Unsafe class injector unless necessary.

This draft also sanitises the AOT compilers to an extent, which should make errors a little less common. Using the -Ddebug_mode=true flag at start-up will print full stack traces along with Skript errors.

Libraries now get their syntax loaded in preference to allow them to override default behaviour as they need to.

- Java
Published by Moderocky about 4 years ago

byteskript - Syntax Library Creation

This is the first draft with custom syntax creation readily available via the compile goal.

Syntax can be added to functions using the syntax entry, which takes effect/expression/property/mode sub-entries. Before it can be used, the class providing syntax must be compiled with the compile goal, and its output moved to the libraries/ directory. The custom syntax will then be available in any future goals. The functions that provide the syntax can be modified without recompiling the library class, as long as the syntax pattern, function name or inputs do not change. If they do, the library must be recompiled so the compiler knows where to look for the syntax.

- Java
Published by Moderocky about 4 years ago

byteskript - Unified Application

This draft unifies the three runnable applications into a single composite Jar. A small console help page is provided with multiple sub-commands for particular actions.

Syntax now provides hints when a match failed but was close to succeeding, e.g. you put an illegal character in a variable name.

Errors thrown are now more concise and easier to read.

Internals are being cleaned up to improve efficiency and remove the chances of a weird edge case throwing an unexpected error. Help is requested in checking for any cases that can generate asymmetric frames - I'd like to catch any of these before a proper release.

- Java
Published by Moderocky about 4 years ago

byteskript - Clean Error Handling

This draft adds clean, readable console errors for parse and runtime failures.

Runtime errors can be used to track the script line where the error occurred. They can also display the chain of Skript trigger calls and the trigger that started the program. image

Parse/compile errors will show the element that failed, and the match information. Syntaxes may suggest help for close matches that failed. image

Full Changelog: https://github.com/Moderocky/ByteSkript/compare/1.0.2...1.0.3

- Java
Published by Moderocky about 4 years ago

byteskript - Type Creation

Custom type creation is available in this draft. See here for information about creating and using types. See here for information about creating and using templates.

The syntax API has some speed and QoL improvements in this version, with more accurate property handlers.

This is build available in the repository.

- Java
Published by Moderocky about 4 years ago

byteskript - Dynamic Function Call-sites

This draft makes some major changes to the internal workings of functions, but should have no changes for users.

In an attempt to reconcile Skript's lack of typing with the JVM's harsh typing, function calls can now access methods with non-object parameters. This version includes the bridge compiler, a new on-the-fly compiler that builds a connecting interface to smartly convert JVM types into Skript objects, and to deal with functions that take atomics. The bridge compiler is available at runtime. Functions now use invokedynamic in all cases, which will make them slightly slower on first call when the bridge compiler is dealt with, but after the first run they will be back to normal speed.

- Java
Published by Moderocky about 4 years ago

byteskript - First Draft Release

This is the first draft release of the ByteSkript compiler.

Documentation is available at https://docs.byteskript.org.

This draft has not been extensively tested and is awaiting feedback.

Information on using the ByteSkript compiler and the Skript language can be found here. Information on creating language libraries (addons) for the ByteSkript compiler can be found here.

- Java
Published by Moderocky about 4 years ago