feat: parallelised compilation #39

Merged
gk1623 merged 18 commits from gleb/parallelisation into master 2025-03-13 01:08:58 +00:00
3 changed files with 167 additions and 155 deletions
Showing only changes of commit d214723f35 - Show all commits

View File

@@ -16,11 +16,6 @@ import com.monovore.decline.Argument
import assemblyIR as asm
case class CliConfig(
file: File = new File(".")
)
given Argument[File] = Argument.from("file") { str =>
val file = File(str)
(
@@ -94,11 +89,14 @@ object Main
version = "1.0"
) {
def main: Opts[IO[ExitCode]] =
Opts.argument[File]("file").map { file =>
Opts.arguments[File]("files").map { files =>
files
.parTraverse_ { file =>
compile(
file.getAbsolutePath,
outFile = Some(File(".", file.getName.stripSuffix(".wacc") + ".s"))
).map(ExitCode(_)) // turn the int into exit code for compatibility with commandioapp
// https://ben.kirw.in/decline/effect.html
)
}
.as(ExitCode.Success)
}
}