lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

After a few months' effort, I have finished the implementation of Dao Virtual Machine(DVM), and released it as 1.0-beta. The DVM is implemented as a very efficient virtual register machine. It is the Lua virtual machine that convinced me to implemented Dao also as a virtual register machine ;-). This is one of the reason that I announce it in this mailling list. Another reason is that Dao is also light-weighted and very efficient, and could be interesting to some Lua users.

This version has implemented all the features I have planned. Most importantly, the implementation has been switched from C++ to standard C. As a consequence, the binary code of DVM is much smaller than before (as executable 250KB, as dynamic linking library 300KB, linux/gcc4). The efficiency has also been improved as well. The structure of DVM has been changed slightly, such that the embedding and extending of DVM becomes more convinient. In fact, now the mechanism to call internal functions is exactly the same as the mechanism to call extended functions. To allow DVM being more freely used, LGPL (GNU Lesser General Public Licence) has been adopted since this release. The DVM can be compiled and run in both windows and linux, but so far, it is tested mainly under linux. As before, the documentation of Dao is not well prepared yet; and there are only a few extended modules available for using. These two things will be the prioritized work in the near future.

links:
website: http://www.xdao.org
documentations: http://www.xdao.org/daoweb.dao?page=document

=========================
Changed or new features
=========================

-----
Multiple lines comment: <<<...>>> is changed to #{...#}, which can be used anywhere in the scripts.

-----
Built-in functions have been organized into some basic libraries: stdlib, stdio, math, reflect, coroutine, thread etc. So now Built-in function xyz(...) should be used abc.xyz(...), where "abc" is the proper library. For convinience and efficiency, one may also do:
xyz = abc.xyz;
xyz(...);

-----
More methods are added for basic data types;

-----
Bit operations |, &, ^, ~, <<, >>;

-----
Typed variables, assignment between variable of different types will issure an error:

a : 1; # a is a number; not compiled virtual instruction;
a := 1; # a is a number; compiled into assignment instruction;

The right side of : or := must be a const. This kind of syntax is for consistence with syntax for specifying typed parameters in function definition;

-----
Similarly class may have typed instance variables. Moreover, "my a := 1" will also specify the default value for the variable;

-----
Class instance creation by enumeration:
class MyNumber
    my value := 0;
end

num1 = MyNumber{ 123 };

num2 = MyNumber {
    value @= 456; # may specify the name of variables to be initialized.
};

Be cautious when enumerating class members without speficying names
to create class instances for derived classes.

-----
Creating multi-dimensional array:

changed from
list = { 2, 3 } : 100;
array = [ 2, 3 ] : 100; # 2 X 3 matrix
to
list = 100 <@> { 2, 3 };
array = 100 <@> [ 2, 3 ];

operator <@> can be called arrange operator. A<@>B, arrange A or copies of A into a list or array of shape B. If B is a list, this operator will create a new list which has shape specified by B, and contains A or copies of A as elements. If B is a numeric array, this operator will create a numeric array with shape B; if A is also a numberic array, the resulting array will contain multiple subarrays that are equal to A.

This new operator is introduce because the previous using colon for multiple purpose is confusing.

-----
Support coroutines similar to Lua coroutines;

-----
Previous built-in functions sort(),apply(),noapply() have become methods of list
or numeric array with some changing in syntax:

before:
sort( list, @0 < @1, n );
now:
list.sort( @{ @0 < @1 }, n );
before:
apply( array[ 1:5, : ], @0 + @1 * @2 );
now:
array.apply( @{ @0 + @1 * @2 }, { 1:5, : } );

Expressions that are used as parameters should be put inside @{ }. The advantage for this is,
simpler parsing; and moreover, they can be passed to C extending functions.

===================
Extending modules:
===================
New modules available:
- DaoCGI: CGI web programming;
- DaoFastCGI: FastCGI web programming;allow DVM to run as FastCGI server;
- DaoSqlite: binding to Sqlite3 database; lighttpd +sqlite +dao could be a good option
             for some websites, since each of them is designed to be light and efficient.
- DaoOpenGL: 3D graphics; support upto DaoOpenGL1.1,including GLU;
- DaoSDL: binding to Single DirectMedia Layer, partially finished;
- DaoCamellia: binding to camellia image processing library;

The previous modules DaoMySQL, DaoBLAS and DaoPython are not yet upgraded accordingly for this release.

Have fun!

Limin Fu
phoolimin[AT]gmail[DOT]com