At 10:48 AM 11/13/2001 -0800, Bob Stewart wrote: >Hi, > >I am looking for a way convert user-inputed >rules into Jess rules. I am able to control >the interface, but it is not trivial to >convert the following user inputed statement: >If ( (x=1) OR (fname=bo*)) >Then (set priority=1). > >The problem I am having is that I am using >Dr. Leff's XML integration, which turns XML >into Jess facts. The facts look like: >(Tag (TagName x) (Text 1)) >(Tag (TagName fname) (Text Bob)) > >The rule would then need to look something like: > >(defrule Rule1 >(Tag (TagName x) (Text "1")) >(Tag (TagName fname) (Text ?name&:(call startswith >?name "bo")) > >Has anyone worked on parsing readable user input into >jess syntax? >
Hi Bob, I performed a similar task with relative ease using JavaCC. In my case I needed to transform JESS syntax (about 10000 lines) into iLog JRules syntax for benchmarking and comparison of the two products. JavaCC can be obtained at http://www.webgain.com/products/java_cc/ It is a parser generator that produces code for a recursive descent parser based on production rules that you specify. It is extremely easy to use and comes with a fairly good set of examples. There is a repository of grammars (also good as examples) at http://www.cobase.cs.ucla.edu/pub/javacc/ I'll dig up the parser I generated for my benchmark if you think it would be useful. Regards, Phillip R. Pfaffman [EMAIL PROTECTED] [Home/Office] +1-626-798-8649 [Fax] +1-626-791-8281 [PGP fingerprint] 224A A856 B8EA 3073 221C 1550 3B44 9BDD 951B 9028 [PGP Key Site] ldap://certserver.pgp.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
