expr.txt 561 B

12345678910111213141516171819202122232425262728293031
  1. f1 = { '/'; '*' }
  2. f2 = { =, <, >, !, <>, <=, >=, =<, => }
  3. AND
  4. OR
  5. a * b + c -> (+ c (* a b))
  6. a + b * c -> (+ a (* b c))
  7. a f1 b f2 c -> (f2 c (f1 a b))
  8. a f2 b f1 c -> (f2 a (f1 b c))
  9. a AND b OR c -> (OR c (AND a b))
  10. a OR b AND c -> (OR a (AND b c))
  11. expr f2 expr
  12. * + = & |
  13. op { + = }
  14. a * b op c -> (op c (* a b))
  15. a op b * c -> (op a (* b c))
  16. a + b = c -> (= c (+ a b))
  17. a = b + c -> (= a (+ b c))
  18. op2 { & | }
  19. a = b op2 c -> (op2 c (= a b))
  20. a op2 b = c -> (op2 a (= b c))
  21. a & b | c -> (| c (& a b))
  22. a | b & c -> (| a (& b c))