29 lines
710 B
Kotlin
29 lines
710 B
Kotlin
import com.xenomachina.argparser.ArgParser
|
|
import interpreter.FileLoader
|
|
import io.GhentPrologArgParser
|
|
import io.Logger
|
|
import repl.Repl
|
|
|
|
fun main(args: Array<String>) {
|
|
// Parse command line arguments
|
|
val parsedArgs = ArgParser(args).parseInto(::GhentPrologArgParser)
|
|
|
|
parsedArgs.run {
|
|
val loader = FileLoader()
|
|
|
|
// Set the verbosity level
|
|
Logger.level = verbosity
|
|
|
|
// Check if script was provided
|
|
for (file in script) {
|
|
loader.load(file)
|
|
}
|
|
|
|
// Check if REPL was requested
|
|
if (repl) {
|
|
Repl()
|
|
} else {
|
|
Logger.warn("REPL not started. Use -r or --repl to start the REPL.")
|
|
}
|
|
}
|
|
}
|