[ Prev | Index | Next ]
Japanese English

How to Build/Use Vnano Engine

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.

Here Let's build and use Vnano Engine practically.


License

Vnano Engine, the interpreter of Vnano scripts, is released under the MIT License.

Here we get source code fo Vnano Engine from its repository on GitHub, and build/use it.

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
ant -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":

- ExampleApp1.java -

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: 5.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 page: 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:

- manifest.txt -
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 page: Main Features of Vnano Engine, and Examples.

Also, for list of methods, options, and so on of Vnano Engine, see the page: 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:

For details of syntax and language feature of Vnano, see the page: 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.

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


Japanese English
Index
News

Opened the Website of Exevalator
2022/07/24 - We have opened the official website of "Exevalator", the open-source expression calculator library (for Java/C#/C++/Rust) we released in April.

The Internal Architecture of Exevalator
2022/05/04 - Explaining the internal architecture of Exevalator, which is an open-source expression calculator library we released last month.

Released "Exevalator": A Multilingual & Copyright-Free Expression Evaluator Library
2022/04/16 - We have released a new library "Exevalator" which enables you to calculate values of numerical expressions stored in string variables, on Java/C#/C++/Rust programs.

Announcement (Twitter)