170 likes | 476 Views
Dao. Caleb Thornton & Jasmine Walker. Programming Language. What is dao?. The word Dao is a Chinese word, with the basic meaning of path or way. It also means fundamental principles, as a concept commonly found in Chinese philosophy. . What is dao ? (cont.).
E N D
Dao Caleb Thornton & Jasmine Walker Programming Language
What is dao? • The word Dao is a Chinese word, with the basic meaning of path or way. • It also means fundamental principles, as a concept commonly found in Chinese philosophy.
What is dao? (cont.) • Dao is a lightweight and optionally typed programming language with many interesting features. It includes features that can make concurrent programming much simpler. It has well design interfaces for easy embedding and extending. • The Dao interpreter runs in a lightweight and efficient virtual machine (Dao VM) in the standard C programming language. Dao also allows direct embedding of C and C++ code into Dao programs through a simple interface.
How did dao come about? • In May of 2004, Fu Limin needed to use Gene Ontology (GO) to complete some analysis, and tried to write various Perl scripts to parse GO files. • He found the syntax of Pearl was rather frustrating, and started to wonder if he could develop a better cleaner syntax. • So he spent some time, and eventually ended up developing a programming language (Dao).
Historical background • The language was developed under different names, initially as Yuan, then as Tao, and finally fixed as Dao (in later 2005). • Before 2006, the language was very different, and the implementation was completely different from what it is now. • In the beginning of 2006, the author was attracted and convinced by the design of the Lua 5 virtual machine, and started to design and implement the Dao interpreter as a new virtual machine with ideas inspired by the Lua virtual machine and instruction set.
What is dao used for? • Dao is an object-oriented scripting language with dynamically-typed variables. • Dao supports complex data structures with built-in types such as complex numbers and multi-dimensional arrays, and includes their corresponding arithmetic operations. • Dao also supports multi-threaded programming, concurrent and distributed programming with message passing, regular expressions, and macros that allow new syntax to be defined.
Main Features • Object-Oriented Programming (OOP) with classes and interfaces • Portable implementation using C • Functional Methods • Special functions called routines • Support for concurrent programming • Concurrent garbage collection • Syntax macro for defining customized syntax
Functional Methods function composition: c = map( a, b )->|x,y|{ x + y, x - y }->|u,v|{ u * v }
Routines a = "ABC"; rout = routine( x, y : string, z = a+a){ a += "_abc"; io.writeln( "lambda ", a ) io.writeln( "lambda ", y ) io.writeln( "lambda ", z ) } rout( 1, "XXX" ); • there is no need for a function name, but the created function must be assigned to a variable; • the default value expressions do not need to be constant expressions, as they are evaluated at run time when the function is created; • the function body may contain variables defined in the "upper" function that creates it.
Multi-threading • Probably the simplest way to create multi-threaded programs in Dao is to use asynchronous function calls (AFC). The way of using AFC is almost identical to that of normal function calls, with the exception that the keyword async must follow the call. • myfunc(myparams)async;
macros syntax{ source_syntax_pattern }as{ target_syntax_pattern } This example enables "while-do-end" without brackets: syntax{ while$EXPdo \[$BL \]end }as{ while($EXP){ \[$BL \] }
Demo • I will now show a demo
Current State • Dao is currently in use and just recently released a new beta for Dao 2.0 • Dao-2.0-Beta1 is released! (2013-05-28)
Statement about the language • I think the language is really cool and I really love the idea of the macros you can create. • It’s a great language for scripting, and it’s convenient for congruent computing.