Skip to content
master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
lib
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Vnano

( » Japanese README )

Logo

Vnano is a simple scripting language having C-like syntax. Its interpreter, Vnano Engine, is designed to be embedded in Java® applications. By using Vnano, you can execute scripts on you apps, so it enable you to develop highly customizable features.

English README Index

( » Japanese )


License

This repository is the source code repository of Vnano Engine, which is the interpreter of Vnano.

Vnano Engine is released under the MIT License.

Requirements

  • Java Development Kit (Version 8 or later is required. The latest version Java 18 is already available.)
  • Git

How to Build

First of all, necessary to build Vnano Engine (interpreter).

For Microsoft Windows

Clone this repository, and execute a batch file "build.bat" included in it:

git clone https://github.com/RINEARN/vnano
cd vnano
.\build.bat

Then the built JAR file "Vnano.jar" will be generated.

For Linux, etc.

Clone this repository, and execute a shell script "build.sh" included in it:

git clone https://github.com/RINEARN/vnano
cd vnano
sudo chmod +x ./build.sh
./build.sh

Then the built JAR file "Vnano.jar" will be generated.

For Apache Ant

Also, if you are using Ant, you can build Vnano Engine as follows:

git clone https://github.com/RINEARN/vnano
cd vnano
and -f build.xml

Then the built JAR file "Vnano.jar" will be generated.

How to Use in Your Apps

How to Compile and Run an Application

Then, Let's try to use Vnano Engine practically, by making a very simple application. The source code of it is included in this repository as "ExampleApp1.java":

(in ExampleApp1.java)

import org.vcssl.nano.VnanoEngine;
import org.vcssl.nano.VnanoException;

 public class ExampleApp1 {
    public static void main(String[] args) throws VnanoException {

        // Create a scripting engine of Vnano (= Vnano Engine).
        VnanoEngine engine = new VnanoEngine();

        // Execute a script by using Vnano Engine.
        String script = "double a = 1.2;  double b = 3.4;  double c = a + b;  c;";
        double result = (Double)engine.executeScript(script);

        // Display the result.
        System.out.println("result: " + result);
    }
}

You can compile the above code as follows:

javac -cp .;Vnano.jar ExampleApp1.java        (For Windows)
javac -cp .:Vnano.jar ExampleApp1.java        (For Linux)

And run it as:

java -cp .;Vnano.jar ExampleApp1        (For Windows)
java -cp .:Vnano.jar ExampleApp1        (For Linux)

The result is:

result: 4.6

The above "ExampleApp1" executes a script by using Vnano Engine, and the script calculates the value of 1.2 + 3.4 = 4.6, so the above result means that we've succeeded to process the script correctly.

For more details to use features of Vnano Engine, see the document: Main Feature of Vnano Engine, and Examples.

How to Create a JAR file of an Application

To create a JAR file of the above "ExampleApp1" application, create a manifest file "manifest.txt" in advance, and in there specify "Vnano.jar" to the Class-Path section as follows:

Main-Class: ExampleApp1
Class-Path: . Vnano.jar

(!!! Important note: This file should ends with a blank line !!!)

Note that, if you want to put "Vnano.jar" in the different folder (e.g. in "lib" folder), you are required to modify the "Class-Path" section of the above manifest file accordingly (e.g. "Class-Path: . lib/Vnano.jar").

Then you can creaet a JAR file as:

jar cvfm ExampleApp1.jar manifest.txt ExampleApp1.class

And you can run the created JAR file "ExampleApp1.jar" as:

java -jar ExampleApp1.jar

Main Features and Specifications

As shown above, by using Vnano Engine, you can execute expression and scripts on your apps.

In addition, you can register fealds and methods of any Java classes to Vnano Engine, and access to them from expressions/scripts. Furthermore, you can implement such Java classes (providing fields and methods) as independent files (called "plug-ins"), and can load them dynamically.

Instead of Java classes, you can define variables and functions in any script files, and can load them dynamically as "library scripts".

By using these features of Vnano Engine, you can develop highly customizable apps (for example, see RINPn, which is a programmable calculator software).

For details of features, see the document: Main Features of Vnano Engine, and Examples.

Also, for list of methods, options, and so on of Vnano Engine, see the document: Specifications of Vnano Engine.

Vnano as a Language

The name of the scripting language executable on Vnano Engine is "Vnano".

Vnano having simple C-like syntax. For example:

int sum = 0;
for (int i=1; i<=100; i++) {
    sum += i;
}
output(sum);

For details of syntax and language feature of Vnano, see the document: Vnano as a Language.

Performances

Our main purpose to develop Vnano Engine is, using it in data-analysis, calculation, and visualization apps. Processing speed is important on such kind of apps, so Vnano Engine can execute scripts at relatively high speed.

For example, on a general laptop PC, as scores under ideal conditions (measuerd by benchmarking scripts): Vnano Engine can perform about 7 million operations per second (700MFLOPS) for scalar values. In addition, it can perform about 15 billion operations per second (15GFLOPS) for values stored in arrays.

For details, see Performance Benchmarking and Analysis.

About Us

Vnano is developed by a Japanese software development studio: RINEARN. The author is Fumihiro Matsui. Please free to contact us if you have any questions, feedbacks, and so on.

References and Links

Following webpages may be useful if you need more information about Vnano.

Credits

  • Oracle and Java are registered trademarks of Oracle and/or its affiliates.

  • Microsoft Windows is either a registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

  • Linux is a trademark of linus torvalds in the United States and/or other countries.

  • Other names may be either a registered trademarks or trademarks of their respective owners.

About

Scripting language/engine embeddable in Java apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages