
APT.all-test.Algebra.algebra.accept-input.convert-input-to-clause-form.process-operation.soar Maven / Gradle / Ivy
sp {convert-input-to-clause-form*propose*process-operation
(state ^name convert-input-to-clause-form
^top-state.problem.current-input-value )
( ^value << |+| |*| |-| |/| |=| >>)
-->
( ^operator + =)
( ^name process-operation)
}
## Just processed left clause - insert operation in current clause
sp {convert-input-to-clause-form*apply*process-operation*post-left
(state ^operator.name process-operation
^top-state )
( ^problem
^operations. )
( ^parse-clause
^current-input-value )
( ^parse-status post-left)
( ^value
^next )
-->
( ^current-input-value -
)
( ^operation )
}
## Just processed right clause - push down current clause and start over above.
sp {convert-input-to-clause-form*apply*process-operation*post-right*diff-op
(state ^operator.name process-operation
^top-state )
( ^problem
^operations. )
( ^current-input-value
^parse-clause )
( ^parse-status post-right
^right-side
^operation { <> <> equal }
^left-side )
( ^value
^next )
-->
( ^current-input-value -
)
( ^left-side
-
^operation
-
^right-side -)
( ^left-side
^right-side
^operation )
}
sp {convert-input-to-clause-form*apply*process-operation*post-right*same-op
(state ^operator.name process-operation
^top-state )
( ^problem
^operations. )
( ^parse-clause
^current-input-value )
( ^parse-status post-right
^right-side
^operation { <> equal }
^left-side )
( ^value
^next )
-->
( ^current-input-value -
)
( ^left-side
-
^right-side -)
( ^left-side
^right-side
^operation )
}
## Just processed right clause after an =. Move down on the right side.
sp {convert-input-to-clause-form*apply*process-operation*post-right*post-equal
(state ^operator.name process-operation
^top-state )
( ^problem
^operations. )
( ^current-input-value
^parse-clause )
( ^parse-status post-right
^right-side
^operation equal
^left-side )
( ^value
^next )
-->
( ^current-input-value -
)
( ^parse-clause -
)
( ^right-side -
)
( ^left-side
^operation )
}
sp {convert-input-to-clause-form*apply*process-operation*failure
(state ^operator.name process-operation
^top-state.problem )
(
^parse-clause.parse-status { <> post-right <> post-left } )
-->
(write (crlf) |Unexpected operation.|)
(
^failed true)
}