NekoVM is a
virtual machine developed by Nicolas Cannasse as part of
research and development
Research and development (R&D or R+D), known in Europe as research and technological development (RTD), is the set of innovative activities undertaken by corporations or governments in developing new services or products, and improving existi ...
(R&D) efforts at two independent
video game developers in
Bordeaux,
France: first at
Motion Twin and then at
Shiro Games
Shiro Games is an independent video game development company based in Bordeaux, France. The company was founded in 2012 by Sebastien Vidal and Nicolas Cannasse, and the company is known for their ''Evoland'' game, which was developed during the 2 ...
. NekoVM's native language is the bytecode for a high-level
dynamically typed programming language called Neko. This pairing allows Neko to be used directly as an embedded scripting language or to target NekoVM by compiling some other language (such as
Haxe) to NekoVM bytecode.
Concept
Neko has a
compiler and a
virtual machine (VM) with
garbage collection. The compiler converts a source .neko file into a bytecode .n file that can be executed with the VM. Since Neko is dynamically typed with no fixed classes, a developer only needs to find the proper runtime mapping (in contrast to type mapping) so that code executes correctly. As the Neko
FAQ puts it: "...it is easier to write a new or existing language on the NekoVM than it is for the
CLR /
JVM
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
, since you don’t have to deal with a highlevel type system. Also, this means that languages can interoperate more easily since they only need to share the same data structures and not always the same types."
Neko requires compiling before executing, like other scripting languages such as Apache
Groovy. Since Neko need not be interpreted at runtime, it executes faster. The
Haxe programming language can compile to Neko code, among other targets.
Virtual machine
The Neko
virtual machine is used to execute a Neko bytecode file, the VM also has the option to convert a bytecode file into an executable file (output changes depending on the target operating system).
Language
Hello World
$print("Hello World!");
Type conversions
$int("67.87"); // Converts string "67.87" to integer 67
$float(12345); // Converts integer 12345 to float 12345.0000
$string($array(1,2,3)); // Converts array ,2,3
The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline ...
to string ",2,3
The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline ...
Objects
o = $new(null); // new empty object
o2 = $new(o); // makes a copy of o
o2 = $new(33); // if parameter is not an object, throw an exception
o.field = value; //sets field to value
o.field; // returns "field" value of object o
Methods
foo = function()
o = $new(null);
o.x = 3;
o.bar = function() ;
o.bar(); // prints 3
Function scope
var x = 3;
f = function()
x = 4;
f(); // print 3
Prototypes
var proto = $new(null);
proto.foo = function()
var o = $new(null);
o.msg = "hello";
$objsetproto(o,proto);
o.foo(); // print "hello"
$objsetproto(o,null); // remove proto
o.foo(); // exception
Web functionality
Neko includes
Apache server module
mod_nekofor Neko language and mod_tora for hosting the NekoVM
application server
An application server is a server that hosts applications or software that delivers a business application through a communication protocol.
An application server framework is a service layer model. It includes software components available to a ...
br>
tora As such, it can process user input using GET and POST requests:
get_params = $loader.loadprim("mod_neko@get_params",0);
$print("PARAMS = "+get_params());
See also
*
Haxe
*
OpenFL
References
External links
*
* {{Web archive , url=https://web.archive.org/web/20131220072451/http://lists.motion-twin.com/pipermail/neko/ , title=Mailing list archives
Dynamically typed programming languages
Free software programmed in C
Free software programmed in OCaml
Object-oriented programming languages
Prototype-based programming languages
Software using the MIT license
Stack-based virtual machines