From 62436b809630ecd3e40bd6e2b45a8870a2866934 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 28 Feb 2022 04:57:40 -0400 Subject: Optimizations for the pure-Lux JVM compiler. [Part 4] --- lux-python/source/program.lux | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'lux-python') diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index bd2e74788..e93019e32 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -37,7 +37,7 @@ ["@" target ["_" python]] [tool - [compiler + ["[0]" compiler ["[0]" phase {"+" Operation Phase} ("[1]#[0]" monad)] [reference [variable {"+" Register}]] @@ -529,13 +529,13 @@ ($_ _.then (_.import "sys") (_.when (_.= (_.string "__main__") (_.var "__name__")) - (_.statement (_.apply/2 program - (|> (_.var "sys") (_.the "argv") - ... The first entry in the list will be the program.py file itself - ... so, it must be removed so only the program's arguments are left. - (_.slice_from (_.int +1)) - runtime.lux::program_args) - _.none))))) + (_.statement (_.apply/* (list (|> (_.var "sys") (_.the "argv") + ... The first entry in the list will be the program.py file itself + ... so, it must be removed so only the program's arguments are left. + (_.slice_from (_.int +1)) + runtime.lux::program_args) + _.none) + program))))) (def: (declare_success! _) (-> Any (Async Any)) @@ -551,14 +551,19 @@ (; (|> (_.__import__/1 (_.unicode "sys")) (_.do "setrecursionlimit" (list max_recursion)))) (_.def @program (list) body) - (; (_.apply/* @program (list))) + (; (_.apply/* (list) @program)) )))) +(def: (lux_compiler it) + (-> Any compiler.Custom) + (undefined)) + (program: [service cli.service] (let [extension ".py"] (exec (do async.monad - [_ (/.compiler (context.python (cli.target service)) + [_ (/.compiler ..lux_compiler + (context.python (cli.target service)) ..expander analysis.bundle ..platform -- cgit v1.2.3