<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/61090af523bf875fc4ebc1a4a14c8ce7"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T15:39:39"
  subject="Re: [Caml-list] Rule based language [was: productivity improvement]"
  prev="2002/07/ac4e05831f30ed07b9b02d83271c6c04"
  next="2002/07/aa90e8987502a2062bb4131d5b0d2901"
  prev-in-thread="2002/07/fe3c7bd3d243f1f7b4c2eed75e44d456"
  next-in-thread="2002/07/ffda4354af9f91affee591b990f23ce1"
  prev-thread="2002/07/c22d9fd21bcea5691f5678e925df1862"
  next-thread="2002/07/1555d185cf3a3a8758041c92a7f7d521"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/315f6c499a501e6f0b02d1bddacd4ee1"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-18T23:13:10"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/4675668fddffa94f558110a6a47fcea6"
  from="William Lovas &lt;wlovas@s...&gt;"
  author="William Lovas"
  date="2002-07-18T23:54:10"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/4890279c2ad66748afc7cb554cf02ebe"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-19T03:58:12"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/cdd23bf04bb19a6191ed787cbb39b10b"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-19T08:21:49"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/0a22394ba16e1be19dbc11a844233536"
  from="Andreas Rossberg &lt;rossberg@p...&gt;"
  author="Andreas Rossberg"
  date="2002-07-19T08:50:40"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/5830232e60808a2a2d12b2619015af15"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T10:06:47"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/c0f52395e551fc67daf00d3613dcd063"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-19T18:15:49"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/b61fd235edd5b365489366fade93ada5"
  from="Brian Smith &lt;brian-l-smith@u...&gt;"
  author="Brian Smith"
  date="2002-07-19T18:33:21"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/5cecdbd360abfdc5b5553e4a24e44dd3"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-20T17:30:44"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
<msg 
  url="2002/07/fcdb1d567d28038f0795dbedc8703612"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T18:59:30"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/1311d5475a156defb5e3448f20d85315"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-20T17:49:11"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/2ca0ce69b274daa5d62c6c200453fdc9"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-19T10:37:27"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/d0f044211e2146d5acbb23e7a5bfbd75"
  from="Andreas Rossberg &lt;rossberg@p...&gt;"
  author="Andreas Rossberg"
  date="2002-07-19T17:19:07"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/e526f6886b6068d87015ec9c87602b52"
  from="John Max Skaller &lt;skaller@o...&gt;"
  author="John Max Skaller"
  date="2002-07-20T16:58:22"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/aa90e8987502a2062bb4131d5b0d2901"
  from="Brian Rogoff &lt;bpr@a...&gt;"
  author="Brian Rogoff"
  date="2002-07-19T16:35:12"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/9a655e0da7b32273cb71f8cc5fe7c8c6"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-17T08:32:49"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/4e7fd140d3b4edee8e9e2f6acc9fd1eb"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T01:18:46"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/fe3c7bd3d243f1f7b4c2eed75e44d456"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-19T04:03:10"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/61090af523bf875fc4ebc1a4a14c8ce7"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T15:39:39"
  subject="Re: [Caml-list] Rule based language [was: productivity improvement]">
<msg 
  url="2002/07/ffda4354af9f91affee591b990f23ce1"
  from="Julie Farago &lt;farago@e...&gt;"
  author="Julie Farago"
  date="2002-07-19T17:20:45"
  subject="[Caml-list] compact.c">
</msg>
</msg>
</msg>
<msg 
  url="2002/10/2673b6a958e12595d4f377eb23300fde"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-15T11:00:27"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/10506201acc84b3fca638f4cce55748f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-10-15T12:34:11"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/227d76b8e3291647b70e216a84ed1050"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-15T17:11:16"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/4ea471c9b5dc5d496a40fb34a60d9f00"
  from="Emmanuel Renieris &lt;er@c...&gt;"
  author="Emmanuel Renieris"
  date="2002-07-19T04:42:09"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/bafcc930158b1e4ef9cf8990deef2a44"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-19T09:56:48"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/ac004f0bf1e2757debd128f2def8ef91"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T10:36:32"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/d268d6d85acf33a994f988ac968b22bc"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2002-07-19T10:52:32"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/07/2c53d122c8500845192452834a5d8d93"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-19T11:29:39"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/12e8fc3009383004d83e8e746bc02072"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-19T11:11:20"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/162c10804d9252dab346d1f6647961a3"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-15T11:00:20"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/32721a368455f27fc6b2ac163ff47e35"
  from="Pal-Kristian Engstad &lt;engstad@n...&gt;"
  author="Pal-Kristian Engstad"
  date="2002-10-15T18:47:16"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/3b927989eeb00f13d1a3a08adb0b5a6d"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-10-17T08:38:01"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/d0b38de16b1d88ea930f2525d7d74e4f"
  from="Diego Olivier Fernandez Pons &lt;Diego-Olivier.FERNANDEZ-PONS@c...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2002-10-17T09:37:54"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/1e715e1544ec6426c6727ba80f862674"
  from="Jeffrey Palmer &lt;jeffrey.palmer@a...&gt;"
  author="Jeffrey Palmer"
  date="2002-10-17T15:55:10"
  subject="Re: [Caml-list] productivity improvement">
<msg 
  url="2002/10/71058b239015be081d7e541a46413fdb"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2002-10-17T16:15:12"
  subject="Re: [Caml-list] productivity improvement">
</msg>
<msg 
  url="2002/10/69ccda807609447f6e2af2b2ea80fffe"
  from="Christophe TROESTLER &lt;debian00@t...&gt;"
  author="Christophe TROESTLER"
  date="2002-10-17T18:18:35"
  subject="[Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
<msg 
  url="2002/10/b3805138b0c1ce941e882eacd4fc29f4"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-10-17T18:32:17"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
<msg 
  url="2002/10/66d9636fac47bb0d8d0c660b7a7c7248"
  from="Shivkumar Chandrasekaran &lt;shiv@e...&gt;"
  author="Shivkumar Chandrasekaran"
  date="2002-10-17T19:07:17"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
<msg 
  url="2002/10/d7aa0ce05030395f08a19034ab71f870"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-10-17T20:01:33"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
</msg>
</msg>
<msg 
  url="2002/10/806efec1e799f5e5422d49df924ab818"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2002-10-17T19:36:46"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
</msg>
<msg 
  url="2002/10/a4392f89c82205d6aa4773c0c0f70926"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2002-10-17T19:53:39"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity  improvement)">
<msg 
  url="2002/10/ddd8ec5b5184177f3e93a81c4b28d0a2"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-10-17T20:22:37"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity  improvement)">
<msg 
  url="2002/10/59fce5d6bf17d1c6e156ae7dd6ec2538"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2002-10-17T21:14:20"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/3eec5b83b44876bb4b82e66661e3b3fc"
  from="Jeffrey Palmer &lt;jeffrey.palmer@a...&gt;"
  author="Jeffrey Palmer"
  date="2002-10-17T21:37:32"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/6491c619e07668fd8cdd02bdbdae9256"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-10-17T23:45:08"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/c0bd2ffc4c8328c165b20226be4c5c76"
  from="Jeffrey Palmer &lt;jeffrey.palmer@a...&gt;"
  author="Jeffrey Palmer"
  date="2002-10-18T00:57:51"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/c266d8e7c314cdea2d0a086091f77b21"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-10-18T04:11:03"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/f1b9af8d9099b116f83eb5d9c6c6db10"
  from="Remi VANICAT &lt;vanicat@l...&gt;"
  author="Remi VANICAT"
  date="2002-10-18T08:23:29"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/a221071f0765da003963569e48fed7e2"
  from="Sven Luther &lt;luther@d...&gt;"
  author="Sven Luther"
  date="2002-10-18T08:46:51"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity improvement)">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/10/2585e980ce3edfe7f38579edd7631029"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2002-10-18T01:41:36"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
</msg>
</msg>
<msg 
  url="2002/10/2e244c3c0a6a92d79ba5a6d70d723f4b"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-10-18T08:29:38"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity   improvement)">
<msg 
  url="2002/10/33dd1413d1a28faa17e2ee72c0a8ef0d"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2002-10-18T23:55:57"
  subject="Re: [Caml-list] Re: Camlp4 optimizations (was: productivity    improvement)">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/10/7ce12a7a2b633b8a4d7b7762f30c116a"
  from="Diego Olivier Fernandez Pons &lt;Diego-Olivier.FERNANDEZ-PONS@c...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2002-10-18T10:45:30"
  subject="Re: [Caml-list] productivity improvement">
</msg>
<msg 
  url="2002/10/dd0c7f80fedaa74938f2ed0a6aaa952e"
  from="Francois Pottier &lt;francois.pottier@i...&gt;"
  author="Francois Pottier"
  date="2002-10-21T08:57:04"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/cfac32c08aafecbb2414ee0832350833"
  from="Brian Smith &lt;blsmith@b...&gt;"
  author="Brian Smith"
  date="2002-07-20T14:28:01"
  subject="Re: [Caml-list] productivity improvement">
</msg>
</msg>
</thread>

<contents>
Oleg wrote:
&gt; On Thursday 18 July 2002 09:25 pm, Alessandro Baretta wrote:
&gt; 
&gt; [...]
&gt; 
&gt; 
&gt;&gt;Ah! Wait a minute. I have another toy project I could
&gt;&gt;propose to you: an interpreter for rule based language, à la
&gt;&gt;CLIPS. 197 lines of code in ocaml, including comments. This
&gt;&gt;is probably the kind of compelling example you are looking
&gt;&gt;for. I coded it in 24 h, including time for sleep, nutrition
&gt;&gt;and general self care.
&gt;&gt;
&gt;&gt;Let me know if you are interested.
&gt; 
&gt; 
&gt; Sure, if it's really compelling, and if I won't have to guess the language 
&gt; specifications.
&gt; 
&gt; Thanks
&gt; Oleg
&gt; 

Here is the specification of the language:

&lt;program&gt; -&gt; &lt;ruleset&gt; &lt;dataset&gt; &lt;goals&gt;

&lt;ruleset&gt; -&gt; ruleset: &lt;rules&gt;
&lt;rules&gt;   -&gt; &lt;rule&gt; &lt;rules&gt; | &lt;epsilon&gt;
&lt;rule&gt;    -&gt; &lt;rule_name&gt; is &lt;preconditions&gt; =&gt;
                  &lt;postconditions&gt;;
&lt;rule_name&gt; -&gt; &lt;token&gt;
&lt;preconditions&gt; -&gt; &lt;conditions&gt;
&lt;postconditions&gt; -&gt; &lt;conditions&gt;
&lt;conditions&gt;    -&gt; &lt;datum&gt; | &lt;datum&gt; and &lt;conditions&gt;
&lt;datum&gt;   -&gt; &lt;token&gt;

&lt;dataset&gt; -&gt; data_set: &lt;data_list&gt;
&lt;data_list&gt; -&gt; &lt;datum&gt;; &lt;data_list&gt; | &lt;epsilon&gt;

&lt;goals&gt;  -&gt; goals: &lt;goal_list&gt;
&lt;goal_list&gt; -&gt; &lt;goal&gt; &lt;goal_list&gt; | &lt;epsilon&gt;
&lt;goal&gt;   -&gt; &lt;simple&gt;? &lt;goal_name&gt; is &lt;conditions&gt;;
&lt;simple&gt; -&gt; simple
&lt;epsilon&gt; -&gt;

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.
&lt;rules.program&gt;
--------------------------------------------------------
ruleset:

1 is x =&gt; y;
2 is x and pippo =&gt; 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 &lt; 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

</contents>

</message>

