From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA03651; Fri, 19 Jul 2002 17:39:39 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA03608 for ; Fri, 19 Jul 2002 17:39:37 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a108.tin.it [62.211.4.108]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6JFdZv21869 for ; Fri, 19 Jul 2002 17:39:36 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id 088352724F; Fri, 19 Jul 2002 17:46:50 +0200 (CEST) Message-ID: <3D383469.9050402@baretta.com> Date: Fri, 19 Jul 2002 17:46:49 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: it, en MIME-Version: 1.0 To: Oleg , Ocaml Subject: Re: [Caml-list] Rule based language [was: productivity improvement] References: <20020716172916.4903.qmail@web10702.mail.yahoo.com> <200207182313.TAA19905@dewberry.cc.columbia.edu> <3D376AA1.8090308@baretta.com> <200207190403.AAA29066@hickory.cc.columbia.edu> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Oleg wrote: > On Thursday 18 July 2002 09:25 pm, Alessandro Baretta wrote: > > [...] > > >>Ah! Wait a minute. I have another toy project I could >>propose to you: an interpreter for rule based language, à la >>CLIPS. 197 lines of code in ocaml, including comments. This >>is probably the kind of compelling example you are looking >>for. I coded it in 24 h, including time for sleep, nutrition >>and general self care. >> >>Let me know if you are interested. > > > Sure, if it's really compelling, and if I won't have to guess the language > specifications. > > Thanks > Oleg > Here is the specification of the language: -> -> ruleset: -> | -> is => ; -> -> -> -> | and -> -> data_set: -> ; | -> goals: -> | -> ? is ; -> simple -> I hope this grammar is complete. I cannot find the original specifications for this language. The interpreter takes a program written in the language specified above and for each goal it attempts to find a sequence of rule activations that lead to the conditions of goal being present contemporarily in the dataset. Since preconditions are removed from the dataset upon rule activation, the logic determined by this language is non monotonous, and backtracking is required to solve the problem. Goals marked simple are tested with out backtracking: the first rule whose preconditions are verified is activated at each step. Goals are all verified from the initial dataset--that is, execution order or goals does not matter. Here's a thirty second test case I cooked up. We'll want something more complete and complex for verification and benchmarking. -------------------------------------------------------- ruleset: 1 is x => y; 2 is x and pippo => z; dataset: foo x; goals: foo is x; simple x is foo; simple sz is z; -------------------------------------------------------- The following is the output the interpreter is supposed to generate. [alex@athlon ocaml]$ ./rules < rules.program Goal pippo: found Goal x: found Goal sz: not found Goal z: found Code on and have fun! Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners