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/parser.lux | 79 +++++++++++++++++++------------- 1 file changed, 47 insertions(+), 32 deletions(-) (limited to 'stdlib/source/program/aedifex/parser.lux') diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 44c16133f..52a9a292c 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -1,32 +1,35 @@ (.using - [library - [lux {"-" Module type} - [abstract - [monad {"+" do}]] - [control - ["<>" parser - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" text] - [collection - ["[0]" dictionary {"+" Dictionary}] - ["[0]" set {"+" Set}]]] - [tool - [compiler - [meta - [archive - [descriptor {"+" Module}]]]]] - [world - [net {"+" URL}]]]] - ["[0]" // "_" - ["/" profile] - ["[1][0]" runtime {"+" Runtime}] - ["[1][0]" project {"+" Project}] - ["[1][0]" dependency] - ["[1][0]" repository "_" - ["[1]" remote]] - ["[1][0]" artifact {"+" Artifact} - ["[1]/[0]" type]]]) + [library + [lux {"-" Module type} + [abstract + [monad {"+" do}]] + [control + ["<>" parser + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" text] + [collection + ["[0]" dictionary {"+" Dictionary}] + ["[0]" set {"+" Set}]]] + [tool + [compiler + [meta + [cli {"+" Compiler}] + [archive + [module + [descriptor {"+" Module}]]]]]] + [world + [net {"+" URL}]]]] + ["[0]" // "_" + ["/" profile] + ["[1][0]" runtime {"+" Runtime}] + ["[1][0]" project {"+" Project}] + ["[1][0]" dependency] + ["[1][0]" format] + ["[1][0]" repository "_" + ["[1]" remote]] + ["[1][0]" artifact {"+" Artifact} + ["[1]/[0]" type]]]) (def: (as_input input) (-> (Maybe Code) (List Code)) @@ -155,6 +158,14 @@ (<>.else //artifact/type.lux_library ..type) ))) +(def: compiler + (Parser Compiler) + (.tuple + ($_ <>.and + .global_symbol + (<>.some .text) + ))) + (def: source (Parser /.Source) .text) @@ -203,9 +214,12 @@ (|> (..plural input "dependencies" ..dependency) (# ! each (set.of_list //dependency.hash)) (<>.else (set.empty //dependency.hash)))) - ^compiler (|> ..dependency - (..singular input "compiler") - (<>.else /.default_compiler)) + ^lux (|> ..dependency + (..singular input //format.lux_compiler_label) + (<>.else /.default_compiler)) + ^compilers (|> ..compiler + (..plural input "compilers") + (<>.else (list))) ^sources (: (Parser (Set /.Source)) (|> (..plural input "sources" ..source) (# ! each (set.of_list text.hash)) @@ -245,7 +259,8 @@ ^info ^repositories ^dependencies - ^compiler + ^lux + ^compilers ^sources ^target ^program -- cgit v1.2.3