NekoVM
   HOME

TheInfoList



OR:

NekoVM is a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
developed by Nicolas Cannasse as part of
research and development Research and development (R&D or R+D), known in some countries as OKB, experiment and design, is the set of innovative activities undertaken by corporations or governments in developing new services or products. R&D constitutes the first stage ...
(R&D) efforts at two independent
video game A video game or computer game is an electronic game that involves interaction with a user interface or input device (such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device) to generate visual fe ...
developers in
Bordeaux Bordeaux ( ; ; Gascon language, Gascon ; ) is a city on the river Garonne in the Gironde Departments of France, department, southwestern France. A port city, it is the capital of the Nouvelle-Aquitaine region, as well as the Prefectures in F ...
,
France France, officially the French Republic, is a country located primarily in Western Europe. Overseas France, Its overseas regions and territories include French Guiana in South America, Saint Pierre and Miquelon in the Atlantic Ocean#North Atlan ...
: first at
Motion Twin Motion Twin is an independent video game development studio, that initially specialized in online video games and has most recently worked on Roguelike, roguelite games. Founded in 2001, the company is a worker cooperative enterprise based in Bo ...
and then at
Shiro Games Shiro Games is a video game development company based in Bordeaux, France. The company was founded in 2012 by Sebastien Vidal and Nicolas Cannasse, and developed the '' Evoland'' series and '' Dune: Spice Wars''. History In 2013 Shiro Games a ...
. NekoVM's native language is the
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
for a
high-level High-level and low-level, as technical terms, are used to classify, describe and point to specific goals of a systematic operation; and are applied in a wide range of contexts, such as, for instance, in domains as widely varied as computer scienc ...
dynamically typed In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usua ...
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
called Neko. This pairing allows Neko to be used directly as an embedded
scripting language In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
, or to target NekoVM by
compiling 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 tha ...
another language (such as
Haxe Haxe is a 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 an MIT License. ...
) to NekoVM bytecode.


Concept

Neko has a
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
and a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
(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 ...
. 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
data type In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
mapping) so that code executes correctly. As the Neko
FAQ A frequently asked questions (FAQ) list is often used in articles, websites, email lists, and online forums where common questions tend to recur, for example through posts or queries by new users related to common knowledge gaps. The purpose of a ...
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 descri ...
, 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 Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. It can be used as both a programming l ...
. Since Neko need not be interpreted at runtime, it executes faster. The
Haxe Haxe is a 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 an MIT License. ...
language can compile to Neko code, among other targets.


Virtual machine

The Neko
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
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. Some typefaces render it as a small line, slightly curved or straight, but inclined from the vertical; others give it the appearance of a miniature fille ...
to string "
,2,3 The comma is a punctuation mark that appears in several variants in different languages. Some typefaces render it as a small line, slightly curved or straight, but inclined from the vertical; others give it the appearance of a miniature fille ...


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, released under the terms of Apache License 2.0. It is developed and maintained by a community of developers under the auspices of the Apache Software Foundation. T ...
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. For a typical web application, the application server sits behind the web servers. An application ser ...
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

*
OpenFL OpenFL is a free and open-source software framework and platform for the creation of multi-platform software application, applications and video games. OpenFL applications can be written in Haxe, JavaScript (EcmaScript 5 or 6+), or TypeScript, and ...


References


External links

* * {{Webarchive , 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