Home Documentation Download Blog Forum Projects

Dao Programming Language


Latest News
A little bit game development in Dao! (2012-05-14)
Dao is a simple yet powerful object-oriented programming language featured by, soft (or optional) typing, BNF-like macro system, regular expression, multi-dimensional numeric array, asynchronous function call for concurrent programming etc. Supporting for multi-threaded programming is also implemented as an integrate part of Dao. Network programming and concurrent programming by message passing interface are supported as standard library of Dao. Moreover, Dao can be easily extended with C/C++, through a simple and transparent interface; and easily embedded into other C/C++ programs as well.

Now the extending modules for Dao are gradually enriching, with modules for: CGI web programming, MYSQL database handling, Lapack and GSL numeric computing, GraphicsMagick image processing, MathGL mathematics plotting, OpenGL 3D graphics, SDL multimedia, VTK 3D model and data visualization, XML docuemt handling and Zlib data compression etc. It worths mentioning that, most of these modules that wrap a C/C++ library are wrapped by an automated tool that generates the wrapping codes directly from the header files of those library, and this automated tool is written in Dao. Moreover, Dao has also included a module with functionality similar to the Ctypes module for Python. This module is based on the FFI library, and allows directly calling C functions of a C library from Dao without wrapping the library.

List of features:
Support by Feature summary
Language Object-oriented programming
Language Optional/soft typing system
Language BNF-like macro, meta-programming
Language Functional programming
Language Arbitrary precision integer (big integer)
Language Tuple type
Language Numeric array type
Built-in Methods String regular expression pattern matching
Built-in Libraries Multi-threaded programming
Built-in Libraries Network programming
Virtual Machine Automatic memory management
Programming Interfaces Embedding and extending
Programming Interfaces Packing script files into executable
Extending Modules Graphical User Interface (GUI) programming
Extending Modules 3D graphics
Extending Modules Image processing
Extending Modules CGI web programming
Extending Modules Database handling
Extending Modules Data compression
Extending Modules XML document handling
Extending Modules Numeric computation
Extending Modules Running time C library binding
Script Tools Automatic wrapping of C/C++ libraries


Here are little pieces of codes just to show how Dao look like:
# explicitly typing:
# declare variable with type:
var1 : double = 0.0;
var2 : map<string,float>;

# implicitly typing:
# define variables by enumerations:
list1 = { 1, 2, 3 }
map1 = { "CD"=>123, "AB"=>456 }
tuple1 = ( 123, "ABC" )
# tuple with named items
tuple2 = ( index => 123, name => "ABC" )
vector = [ 1, 2, 3 ]
matrix = [ 1, 2; 3, 4 ]

tuple2.name = "another name";
stdio.println( matrix[1,:] ); # second row

# function with parameter annotation:
routine Bar( a, b : int, c = "DEFAULT" )
{
   stdio.println( "parameters:", a, b, c )
}

class Point
{
  var X, Y, Z = 0.0;

  routine Point( x=0.0, y=0.0, z=0.0 ){
   X = x; Y = y; Z = z;
  }
}
# different ways of constructing class instances:
p1 = Point( 1, 2, 3 ); # calling constructor
p2 = Point{ 1, 2, 3 }; # enumerating fields
p3 = Point{ Z=>1, X=>2, Y=>3 }; # enumerating fields by names

# generators and coroutines with typed interfaces:
# int => tuple<int,int>
routine gen1( a = 0 )
{
  k = 0;
   while( k ++ < 3 ) a = yield( k, a );
    return 0,0;
}
routine gen2( a = 0 )
{
  return gen1( a );
}
g = @gen2( 1 );
stdio.println( 'main1: ', g( 1 ) );
stdio.println( 'main2: ', g( 100 ) );
stdio.println( 'main3: ', g( 200 ) );

# functional methods:
# method( parameter(s) )->|variable(s)|{ inlined_function }

a = { 1, 2, 3 }
b = map( a ) -> { 10*x } # produce { 10, 20, 30 }
b = map( a ) -> |x| { 10*x } # equivalent to above

# map() can take more than one lists as parameters:
b = { 11, 22, 33 }
c = map( a, b ) -> |x,y| { x + y }

# function composition
c = map( a, b )->|x,y|{ x + y, x - y }->|u,v| { u * v }

view count 52184 times
created at 2009-02-19, 17:46 GMT
modified at 2009-09-22, 00:03 GMT

1234 5
67891011 12
131415161718 19
202122232425 26
2728293031

fu: A little bit game development in Dao! Thanks to ClangDao, it has become very easy to create bindings for C/ C++ libraries. The latest one i ... (May.14,07:08)

dao: Dao 1.2 Beta1 is released! After a very long time of development, the first beta release for Dao 1.2 is finally available ( http ... (May.06,23:37)

fu: ... Just to mention: a couple of demos (including the 2000 line one) has been successfully ported to IPho ... (May.19,02:43)

fu: ... Yes, it is getting mature, and more libraries and modules are coming out, hehe:) For GameKit, unfor ... (May.19,02:38)

Pompei2: ... This is cool news and really shows that ClangDao is getting mature, thumbs up. Too bad for this litt ... (May.18,09:17)

fu: ... Not completely, but mostly. New revisions will be regularly pushed to the repository on google code ( ... (May.08,22:38)

Pompei2: ... If I understand it correctly, you want to completely switch? If so then: (May.08,08:46)

This site is powered by Dao
Copyright (C) 2009-2012, daovm.net.
Webmaster: admin@daovm.net