REPL checkpoint

This commit is contained in:
Tibo De Peuter 2025-04-18 20:36:11 +02:00
parent 69c156024a
commit 1b3280a947
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
21 changed files with 503 additions and 34 deletions

View file

@ -0,0 +1,23 @@
package interpreter
import better_parser.PrologParser
class SourceFileReader {
private val parser = PrologParser()
fun readFile(filePath: String) {
return try {
val file = java.io.File(filePath)
if (!file.exists()) {
throw IllegalArgumentException("File not found: $filePath")
}
val content = file.readText()
// Parse the content using SimpleSourceParser
parser.parse(content)
} catch (e: Exception) {
throw RuntimeException("Error reading file: $filePath", e)
}
}
}