Skip to content

Sample Java library that adds new instructions to Aya

Notifications You must be signed in to change notification settings

aya-lang/aya-library-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aya Java Library Example

Add new operators to Aya at runtime

How to use

You can either download the jar from the releases page or build the library yourself (see below)

Then in aya, use the :(library.load) operator to load the jar. Make sure to use the correct path to where you have the jar saved

:(library.load) will return a list of loaded operators. In this case, there are 2.

aya> "target/aya-library-example-1.0-SNAPSHOT.jar" :(library.load)
[ ":(example.instruction)" ":(example.instruction2)" ]
aya> :(example.instruction)
"hello, world"
aya> :(example.instruction2)
"foo bar"
aya> 

You can also use the import statement to load the jar. This will not return the list of loaded operators

aya> import "target/aya-library-example-1.0-SNAPSHOT.jar"
aya> :(example.instruction)
"hello, world"

Building

Install Aya

To build, first install Aya. To install, clone the repo, then from inside the aya dir, run mvn install

git clone https://github.com/aya-lang/aya.git
cd aya
mvn install

Build

To build this library, run the package command

mvn package

Adding more Instructions

A jar can provide one or more NamedInstructionStore implementations.
This is done by adding the fully qualified class name(s) to this file: META-INF/services/aya.instruction.named.NamedInstructionStore

For more information, you should look up 'Java SPI' (Service Provider Interface).

Contributors

  • @BlazingTwist
  • @nick-paul

About

Sample Java library that adds new instructions to Aya

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages