From 290de8ebcb7edc92877f2ccc333171214e5eae23 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 6 Feb 2022 03:15:39 -0400 Subject: Finishing the meta-compiler [Part 1] --- stdlib/source/program/aedifex/format.lux | 51 ++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'stdlib/source/program/aedifex/format.lux') diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 8f3e63706..54e1ed57f 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -1,22 +1,26 @@ (.using - [library - [lux "*" - [data - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" dictionary {"+" Dictionary}] - ["[0]" list ("[1]#[0]" monad)] - ["[0]" set {"+" Set}]]] - [macro - ["[0]" code] - ["[0]" template]]]] - ["[0]" // "_" - ["/" profile] - ["[1][0]" runtime {"+" Runtime}] - ["[1][0]" project {"+" Project}] - ["[1][0]" dependency {"+" Dependency}] - ["[1][0]" artifact {"+" Artifact} - ["[1]/[0]" type]]]) + [library + [lux "*" + [data + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" dictionary {"+" Dictionary}] + ["[0]" list ("[1]#[0]" monad)] + ["[0]" set {"+" Set}]]] + [macro + ["[0]" code] + ["[0]" template]] + [tool + [compiler + [meta + [cli {"+" Compiler}]]]]]] + ["[0]" // "_" + ["/" profile] + ["[1][0]" runtime {"+" Runtime}] + ["[1][0]" project {"+" Project}] + ["[1][0]" dependency {"+" Dependency}] + ["[1][0]" artifact {"+" Artifact} + ["[1]/[0]" type]]]) (type: .public (Format a) (-> a Code)) @@ -141,6 +145,14 @@ (` [(~ (code.text program)) (~+ (list#each code.text parameters))])) +(def: (compiler [definition parameters]) + (Format Compiler) + (` [(~ (code.symbol definition)) + (~+ (list#each code.text parameters))])) + +(def: .public lux_compiler_label + "lux") + (def: (profile value) (Format /.Profile) (`` (|> ..empty @@ -149,7 +161,8 @@ (..on_maybe "info" (value@ /.#info value) ..info) (..on_set "repositories" (value@ /.#repositories value) code.text) (..on_set "dependencies" (value@ /.#dependencies value) ..dependency) - (dictionary.has "compiler" (..dependency (value@ /.#compiler value))) + (dictionary.has ..lux_compiler_label (..dependency (value@ /.#lux value))) + (..on_list "compilers" (value@ /.#compilers value) ..compiler) (..on_set "sources" (value@ /.#sources value) code.text) (dictionary.has "target" (code.text (value@ /.#target value))) (..on_maybe "program" (value@ /.#program value) code.text) -- cgit v1.2.3