mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
vm: a functional virtual machine, mostly
This commit is contained in:
@ -24,7 +24,12 @@ class CompileCommand : CliktCommand(help = "Compile Pork to Bytecode", name = "c
|
||||
val code = compiledWorld.code.subList(symbol.offset.toInt(), (symbol.offset + symbol.size).toInt())
|
||||
println(symbol.id)
|
||||
for ((index, op) in code.withIndex()) {
|
||||
println(" ${symbol.offset + index.toUInt()} ${op.code.name} ${op.args.joinToString(" ")}")
|
||||
var annotation = ""
|
||||
val annotations = compiledWorld.annotations.filter { it.inst == (symbol.offset + index.toUInt()) }
|
||||
if (annotations.isNotEmpty()) {
|
||||
annotation = " ; ${annotations.joinToString(", ") { it.text}}"
|
||||
}
|
||||
println(" ${symbol.offset + index.toUInt()} ${op.code.name} ${op.args.joinToString(" ")}${annotation}")
|
||||
}
|
||||
}
|
||||
val vm = VirtualMachine(compiledWorld)
|
||||
|
@ -20,7 +20,7 @@ class ScopeAnalysisCommand : CliktCommand(help = "Run Scope Analysis", name = "s
|
||||
"symbol ${visibleScopeSymbol.scopeSymbol.symbol.id} " +
|
||||
"type=${visibleScopeSymbol.scopeSymbol.definition.type.name} " +
|
||||
"internal=${visibleScopeSymbol.isInternalSymbol} " +
|
||||
"slab=${visibleScopeSymbol.scopeSymbol.slab.location.commonFriendlyName}"
|
||||
"slab=${visibleScopeSymbol.scopeSymbol.slabScope.slab.location.commonFriendlyName}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user