remove dysfunctional repl

This commit is contained in:
Irmen de Jong 2019-08-10 21:36:26 +02:00
parent 8917926996
commit 1c151f4a3f
2 changed files with 0 additions and 44 deletions

View File

@ -4,7 +4,6 @@ import prog8.ast.base.AstException
import prog8.compiler.CompilationResult
import prog8.compiler.compileProgram
import prog8.parser.ParsingFailedError
import prog8.repl.Repl
import prog8.vm.astvm.AstVm
import java.nio.file.FileSystems
import java.nio.file.Path
@ -37,7 +36,6 @@ private fun compileMain(args: Array<String>) {
var optimize = true
var optimizeInlining = true
var launchAstVm = false
var launchRepl = false
var watchMode = false
for (arg in args) {
if(arg=="-emu")
@ -52,8 +50,6 @@ private fun compileMain(args: Array<String>) {
optimizeInlining = false
else if(arg=="-avm")
launchAstVm = true
else if(arg=="-repl")
launchRepl = true
else if(arg=="-watch")
watchMode = true
else if(!arg.startsWith("-"))
@ -93,9 +89,6 @@ private fun compileMain(args: Array<String>) {
}
}
} else if(launchRepl) {
val repl = Repl()
repl.loop()
} else {
if(moduleFile.isBlank())
usage()
@ -142,7 +135,6 @@ private fun usage() {
System.err.println(" [-emu] auto-start the 'x64' C-64 emulator after successful compilation")
System.err.println(" [-emu2] auto-start the 'x64sc' C-64 emulator after successful compilation")
System.err.println(" [-avm] launch the prog8 ast-based virtual machine after compilation")
System.err.println(" [-repl] launch the prog8 REPL (interactive mode)")
System.err.println(" [-watch] continuous compilation mode (watches for file changes)")
System.err.println(" modulefile main module file to compile")
exitProcess(1)

View File

@ -1,36 +0,0 @@
package prog8.repl
import prog8.compiler.compileProgram
import prog8.compiler.printAst
import java.io.File
import java.nio.file.Path
class Repl() {
fun loop() {
println("~~totally unfinished experimental REPL~~\n")
while(true) {
print("> ")
val input = readLine() ?: break
val replmodule = createReplModule(input)
val compilationResult = compileProgram(replmodule, false, false, false)
printAst(compilationResult.programAst)
println("")
}
}
private fun createReplModule(input: String): Path {
val replmodule = File("replmodule.p8")
replmodule.writeText("""
%option enable_floats
main {
sub start() {
${input.trim()}
}
}
""")
return replmodule.toPath()
}
}