Implement token node attribution and a Dart compiler.

This commit is contained in:
2023-08-30 03:54:14 -07:00
parent 743bc00bab
commit 900e3f1a1c
9 changed files with 213 additions and 26 deletions

View File

@ -0,0 +1,16 @@
package gay.pizza.pork.cli
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.types.path
import gay.pizza.pork.compiler.DartCompiler
import gay.pizza.pork.frontend.FileFrontend
class GenerateDartCommand : CliktCommand(help = "Generate Dart Code", name = "generate-dart") {
val path by argument("file").path(mustExist = true, canBeDir = false)
override fun run() {
val frontend = FileFrontend(path)
println(frontend.visit(DartCompiler()))
}
}

View File

@ -14,7 +14,8 @@ class RootCommand : CliktCommand(
TokenizeCommand(),
ReprintCommand(),
AstCommand(),
GenerateKotlinCommand()
GenerateKotlinCommand(),
GenerateDartCommand()
)
}