mirror of
https://github.com/irmen/prog8.git
synced 2024-10-19 07:23:56 +00:00
remove dysfunctional repl
This commit is contained in:
parent
8917926996
commit
1c151f4a3f
@ -4,7 +4,6 @@ import prog8.ast.base.AstException
|
|||||||
import prog8.compiler.CompilationResult
|
import prog8.compiler.CompilationResult
|
||||||
import prog8.compiler.compileProgram
|
import prog8.compiler.compileProgram
|
||||||
import prog8.parser.ParsingFailedError
|
import prog8.parser.ParsingFailedError
|
||||||
import prog8.repl.Repl
|
|
||||||
import prog8.vm.astvm.AstVm
|
import prog8.vm.astvm.AstVm
|
||||||
import java.nio.file.FileSystems
|
import java.nio.file.FileSystems
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@ -37,7 +36,6 @@ private fun compileMain(args: Array<String>) {
|
|||||||
var optimize = true
|
var optimize = true
|
||||||
var optimizeInlining = true
|
var optimizeInlining = true
|
||||||
var launchAstVm = false
|
var launchAstVm = false
|
||||||
var launchRepl = false
|
|
||||||
var watchMode = false
|
var watchMode = false
|
||||||
for (arg in args) {
|
for (arg in args) {
|
||||||
if(arg=="-emu")
|
if(arg=="-emu")
|
||||||
@ -52,8 +50,6 @@ private fun compileMain(args: Array<String>) {
|
|||||||
optimizeInlining = false
|
optimizeInlining = false
|
||||||
else if(arg=="-avm")
|
else if(arg=="-avm")
|
||||||
launchAstVm = true
|
launchAstVm = true
|
||||||
else if(arg=="-repl")
|
|
||||||
launchRepl = true
|
|
||||||
else if(arg=="-watch")
|
else if(arg=="-watch")
|
||||||
watchMode = true
|
watchMode = true
|
||||||
else if(!arg.startsWith("-"))
|
else if(!arg.startsWith("-"))
|
||||||
@ -93,9 +89,6 @@ private fun compileMain(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(launchRepl) {
|
|
||||||
val repl = Repl()
|
|
||||||
repl.loop()
|
|
||||||
} else {
|
} else {
|
||||||
if(moduleFile.isBlank())
|
if(moduleFile.isBlank())
|
||||||
usage()
|
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(" [-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(" [-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(" [-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(" [-watch] continuous compilation mode (watches for file changes)")
|
||||||
System.err.println(" modulefile main module file to compile")
|
System.err.println(" modulefile main module file to compile")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
|
@ -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()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user