From 1fabe19f7eacb668ef26cccde681dce5e2f98072 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 26 Oct 2017 14:48:05 -0400 Subject: - WIP: Wiring everything to get the compiler to work fully. - Fixed a bug when combining field/method/class modifiers. --- new-luxc/source/program.lux | 87 ++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 37 deletions(-) (limited to 'new-luxc/source/program.lux') diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux index ecf5cdd6f..3e94c7521 100644 --- a/new-luxc/source/program.lux +++ b/new-luxc/source/program.lux @@ -1,40 +1,53 @@ (;module: lux - (lux (control monad) + (lux (control monad + ["p" parser]) + (concurrency ["P" promise] + ["T" task]) + (data ["e" error]) [io #- run] - [cli #+ program: CLI Monad]) - (luxc ["&" base] - ["&;" parser] - ["&;" compiler] - (module (descriptor ["&;" type])) - )) - -(type: Compilation - {#program &;Path - #target &;Path}) - -(def: (marker tokens) - (-> (List Text) (CLI Unit)) - (cli;after (cli;option tokens) - (:: Monad wrap []))) - -(def: (tagged tags) - (-> (List Text) (CLI Text)) - (cli;after (cli;option tags) - cli;any)) - -(def: compilation^ - (CLI Compilation) - ($_ cli;seq - (tagged (list "-p" "--program")) - (tagged (list "-t" "--target")))) - -(program: ([command (cli;opt compilation^)] - [sources (cli;some (tagged (list "-s" "--source")))]) - (case command - #;None - (io (log! "No REPL for you!")) - - (#;Some [program target]) - (exec (&compiler;compile-program program target sources) - (io [])))) + [cli #+ program: CLI]) + (luxc ["&;" generator])) + +## (type: Compilation +## {#program &;Path +## #target &;Path}) + +## (def: (marker tokens) +## (-> (List Text) (CLI Unit)) +## (cli;after (cli;option tokens) +## (:: Monad wrap []))) + +## (def: (tagged tags) +## (-> (List Text) (CLI Text)) +## (cli;after (cli;option tags) +## cli;any)) + +## (def: compilation^ +## (CLI Compilation) +## ($_ cli;seq +## (tagged (list "-p" "--program")) +## (tagged (list "-t" "--target")))) + +## (program: ([command (cli;opt compilation^)] +## [sources (cli;some (tagged (list "-s" "--source")))]) +## (case command +## #;None +## (io (log! "No REPL for you!")) + +## (#;Some [program target]) +## (exec (&compiler;compile-program program target sources) +## (io [])))) + +(def: (or-crash! action) + (All [a] (-> (T;Task a) (P;Promise a))) + (do P;Monad + [?output action] + (case ?output + (#e;Error error) + (error! error) + + (#e;Success output) + (wrap output)))) + + -- cgit v1.2.3