NekoVM
   HOME

TheInfoList



OR:

NekoVM is a
virtual machine In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
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 Video games, also known as computer games, are electronic games that involves interaction with a user interface or input device such as a joystick, controller, keyboard, or motion sensing device to generate visual feedback. This fee ...
developers in
Bordeaux Bordeaux ( , ; Gascon oc, Bordèu ; eu, Bordele; it, Bordò; es, Burdeos) is a port city on the river Garonne in the Gironde department, Southwestern France. It is the capital of the Nouvelle-Aquitaine region, as well as the prefectur ...
,
France France (), officially the French Republic ( ), is a country primarily located in Western Europe. It also comprises of Overseas France, overseas regions and territories in the Americas and the Atlantic Ocean, Atlantic, Pacific Ocean, Pac ...
: first at
Motion Twin Motion Twin is an independent studio specializing in online video games. Founded in 2001 the company is a worker cooperative enterprise based in Bordeaux, France. History With the success of ''Dead Cells'' into 2019, Motion Twin wanted to mov ...
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 In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
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 Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
) to NekoVM bytecode.


Concept

Neko has a
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
and a
virtual machine In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
(VM) with
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
. 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 CLR may refer to: * Calcium Lime Rust, a household cleaning-product * California Law Review, a publication by the UC Berkeley School of Law * Tube_bending, Centerline Radius, a term in the tubing industry used to describe the radius of a bend * Cen ...
/
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 ''Groovy'' (or, less commonly, ''groovie'' or ''groovey'') is a slang colloquialism popular during the 1950s, '60s and '70s. It is roughly synonymous with words such as "excellent", "fashionable", or "amazing", depending on context. History The ...
. Since Neko need not be interpreted at runtime, it executes faster. The
Haxe Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
programming language can compile to Neko code, among other targets.


Virtual machine

The Neko
virtual machine In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
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 The Apache HTTP Server ( ) is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Soft ...
module
mod_neko
for 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 Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
*
OpenFL OpenFL is a free and open-source software framework and platform for the creation of multi-platform applications and video games. OpenFL applications can be written in Haxe, JavaScript (EcmaScript 5 or 6+), or TypeScript, and may be published as s ...


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