Skip to content
Ax Kr edited this page Jul 29, 2018 · 10 revisions

Translate rewriting rules

The RulePreprocessor.java can be used to translate files with term rewriting rules from the /rules folder into Java interfaces in the package org.matheclipse.core.reflection.system.rules

For example for the Cos function the rules can be added like this:

...
      import org.matheclipse.core.reflection.system.rules.CosRules;
...

      private final static class Cos extends ... implements ..., CosRules  {
...

...
		@Override
		public IAST getRuleAST() {
			return RULES;
		}

		@Override
		public void setUp(final ISymbol newSymbol) {
			newSymbol.setAttributes(ISymbol.LISTABLE | ISymbol.NUMERICFUNCTION);
			// call AbstractFunctionEvaluator#setUp() to initialize rules
			super.setUp(newSymbol);
		}
      }
Clone this wiki locally