simpler over view on dao: a functional logic solver with builtin parsing power, and dinpy, the sugar syntax for dao in python

Simeon Chaos simeon.chaos at gmail.com
Tue Nov 8 00:34:55 EST 2011


Dao is a a functional logic solver (similar to lambdaProlog, Curry)
written in python. The links related to dao are here:

pypi distribution and document: http://pypi.python.org/pypi/daot

code repository: https://github.com/chaosim/dao

dao groups on google: http://groups.google.com/group/daot,
daot at googlegroups.com

old stuffs: http://code.google.com/p/daot(old, deprecated)

google+ pages: https://plus.google.com/112050694070234685790

Dao has the features such as

*   lisp style programming:

    *  call/cc, block/return-from, unwind-protect, catch/throw;

    *  function and macro;

    *  eval, so called meta circular evaluation.

* prolog style programming:

    *  logic variable and unify;

    *   backtracking;

    *   findall, repeat/fail, call, once, and so on;

    *   cut.

* many other useful builtins that simulate lisp and prolog
primitives.

* some builtins that cooperate with python.

* builtin parser, which is the most powerful parser I have seen, it
support the features as below:

    *   paramater grammar, similar to DCG( definite clause grammar),
but more flexible
    *   dynamic grammar,
    *   left recursive
    *   memoriaziont parsing result
    *   many builtins, include terminal and cominative matchers.

-------------------------------------------------------------------------

Dinpy: a child language born and live in python.

  Dinpy can be looked as the syntax sugar for dao in python. A piece
of code in dinpy is listed as below:

        parse_text(char(x1)+any(~char('b')+some(char(x1)))+eoi,
'abaaaa'),

	let( i<<0 ). do[ repeat, prin(i), ++i, iff(i<3).do[fail] ],

	letr( a << fun(x) [ and_p(b(x),c(x)) ]
			  [ d(x) ],
	      b << fun(1) ['b1']
		      (4) ['b4'],
	      c << fun(4) ['c4'],
	      d << fun(3) ['d3'],
	     ).do[
	     a(x), prin(x) ],

	each(i)[1:3].
	  loop[prin(i)],

	i << 0,
	loop[ i << i+1, prin(i)].when(i==3),

	case(1).
	  of(1)[prin(1)].
	  of(2)[prin(2)]

--------------------------------------------------------------------------

Some Chinese documents for dao is written, but few English. The
Chinese document is not complete yet.

With the functional logic programming and dynamic grammar on the
shoulders of the great python, many possibilities arises with dao,
such as parsing, inventing embedded DSL with operator syntax,
independent domain specific language or general language, text
processing, natural language processing, expert system, artificial
intelligence, web application, and so on.

Now:

* I hope more people know and use dao. Or maybe something wrong in dao
prevent it being used in real application, and I hope to know what it
is.

* Maybe anyone have interest and time to join in developing dao or
writing some documents or articles?

* More tests are needed always, and I hope to get some bug report from
any other people.

* the benchmarks of the dao, comparation with similar package, and so
on.

* I have a long todo list, I hope someone else can join in dao project.



More information about the Python-list mailing list