Checkpoint
This commit is contained in:
parent
23b2ce9362
commit
f9017da734
18 changed files with 814 additions and 412 deletions
|
@ -59,6 +59,7 @@ open class Preprocessor {
|
|||
Structure(Atom("!"), emptyList()) -> Cut()
|
||||
Atom("inf") -> Integer(Int.MAX_VALUE)
|
||||
Atom("nl") -> Nl
|
||||
Variable("_") -> AnonymousVariable.create()
|
||||
is Structure -> {
|
||||
// Preprocess the arguments first to recognize builtins
|
||||
val args = term.arguments.map { preprocess(it, nested = true) }
|
||||
|
@ -86,6 +87,10 @@ open class Preprocessor {
|
|||
Not(args[0] as Goal)
|
||||
}
|
||||
|
||||
term.functor == "==/2" -> {
|
||||
Equivalent(args[0], args[1])
|
||||
}
|
||||
|
||||
term.functor == "=\\=/2" && args.all { it is Expression } -> {
|
||||
EvaluatesToDifferent(args[0] as Expression, args[1] as Expression)
|
||||
}
|
||||
|
@ -133,7 +138,10 @@ open class Preprocessor {
|
|||
term.functor == "read/1" -> Read(args[0])
|
||||
term.functor == "initialization/1" -> Initialization(args[0] as Goal)
|
||||
|
||||
else -> term
|
||||
else -> {
|
||||
term.arguments = args
|
||||
term
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue