PROLAN/M interpreter in javascript

formmeaningformmeaning
(p,r)rule: rewrite p as r(,)empty pattern: halt
 rules are tried top to bottom halts also when no rule matches
 first rule that matches fires, on its leftmost occurrence($,...)a pattern that never occurs is a comment
 after a rewrite, scanning restarts from the top text outside parentheses is ignored


 

  STRING