Dao Programming Language


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  );
                return0,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 21000 times
created at 2009-02-19, 17:46 GMT
modified at 2009-09-22, 00:03 GMT

12 3 4
5678910 11
121314151617 18
192021222324 25
2627282930

klabim: ... Ok, I found it. It can be so easy by reading the documentation :- ). I have overseen the keyword glob ... (Aug.21,18:09)

klabim: sharing vars between scripts Hi, how can I share a variable between 2 scripts in an embedded environment? For example: script 1: ... (Aug.21,17:55)

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