From 9ae7272d50b64dc9c8651e7a684abc007d4f2caf Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 8 Sep 2021 17:52:13 -0400 Subject: Post annotations clean-up. --- stdlib/source/library/lux.lux | 5 --- .../library/lux/control/security/capability.lux | 6 +-- .../library/lux/macro/syntax/annotations.lux | 42 --------------------- .../source/library/lux/macro/syntax/definition.lux | 44 +--------------------- .../library/lux/tool/compiler/language/lux.lux | 4 +- .../language/lux/phase/analysis/reference.lux | 2 +- .../language/lux/phase/extension/analysis/lux.lux | 2 +- .../language/lux/phase/extension/directive/lux.lux | 39 ++++++++----------- .../library/lux/tool/compiler/meta/io/archive.lux | 4 +- 9 files changed, 25 insertions(+), 123 deletions(-) delete mode 100644 stdlib/source/library/lux/macro/syntax/annotations.lux (limited to 'stdlib/source/library') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 4b1204bc7..93e5c00cc 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -796,11 +796,6 @@ export_policy) #End)) - (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End))) - (in_meta (#Item (as_def name (as_macro (as_function name args body)) - export_policy) - #End)) - _ (failure "Wrong syntax for macro:'")} tokens))) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 5d7ff9ebb..4bdab69c1 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -21,8 +21,7 @@ ["[0]" code] [syntax {"+" [syntax:]} ["|[0]|" export] - ["|[0]|" declaration] - ["|[0]|" annotations]]]]]) + ["|[0]|" declaration]]]]]) (abstract: .public (Capability brand input output) (-> input output) @@ -40,11 +39,10 @@ output)) ((:representation capability) input)) - (syntax: .public (capability: [[export_policy declaration annotations [forger input output]] + (syntax: .public (capability: [[export_policy declaration [forger input output]] (|export|.parser ($_ <>.and |declaration|.parser - (<>.maybe |annotations|.parser) (.form ($_ <>.and .local_identifier .any .any))))]) (macro.with_identifiers [g!_] (do [! meta.monad] diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux deleted file mode 100644 index 6366f725f..000000000 --- a/stdlib/source/library/lux/macro/syntax/annotations.lux +++ /dev/null @@ -1,42 +0,0 @@ -(.module: - [library - [lux "*" - [abstract - [equivalence {"+" [Equivalence]}]] - [control - ["[0]" function] - ["<>" parser - ["<[0]>" code {"+" [Parser]}]]] - [data - ["[0]" product] - ["[0]" name] - [collection - ["[0]" list ("[1]\[0]" functor)]]] - [macro - ["[0]" code]]]]) - -(type: .public Annotations - (List [Name Code])) - -(def: .public equivalence - (Equivalence Annotations) - (list.equivalence - (product.equivalence name.equivalence - code.equivalence))) - -(def: .public empty - Annotations - (list)) - -(def: .public format - (-> Annotations Code) - (let [entry (product.then code.tag function.identity)] - (|>> (list\each entry) - code.record))) - -(def: .public parser - (Parser Annotations) - (.record - (<>.some - (<>.and .tag - .any)))) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index ac65e7357..3f92e3118 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -22,7 +22,6 @@ ["[0]" meta ["[0]" location]]]] ["[0]" // - ["[1][0]" annotations {"+" [Annotations]}] ["[1][0]" check {"+" [Check]}]]) (type: .public Definition @@ -30,7 +29,6 @@ [#name Text #value (Either Check Code) - #anns Annotations #export? Bit])) (def: .public equivalence @@ -41,36 +39,19 @@ //check.equivalence code.equivalence ) - //annotations.equivalence bit.equivalence )) (def: extension "lux def") -(def: (tag_format [module short]) - (-> Name Code) - (` [(~ (code.text module)) - (~ (code.text short))])) - -(def: (annotations_format value) - (-> Annotations Code) - (case value - #.End - (` #.End) - - (#.Item [name value] tail) - (` (#.Item [(~ (..tag_format name)) - (~ value)] - (~ (annotations_format tail)))))) - (def: dummy Code (` [#.module (~ (code.text (value@ #.module location.dummy))) #.line (~ (code.nat (value@ #.line location.dummy))) #.column (~ (code.nat (value@ #.column location.dummy)))])) -(def: .public (format (^slots [#name #value #anns #export?])) +(def: .public (format (^slots [#name #value #export?])) (-> Definition Code) (` ((~ (code.text ..extension)) (~ (code.local_identifier name)) @@ -80,26 +61,8 @@ (#.Right value) value)) - [(~ ..dummy) (#.Record (~ (..annotations_format anns)))] (~ (code.bit export?))))) -(def: tag_parser - (Parser Name) - (.tuple (<>.and .text .text))) - -(def: annotations_parser - (Parser Annotations) - (<>.rec - (function (_ recur) - ($_ <>.or - (.tag! (name_of #.End)) - (.form (do <>.monad - [_ (.tag! (name_of #.Item)) - [head tail] (<>.and (.tuple (<>.and tag_parser .any)) - recur)] - (in [head tail]))) - )))) - (def: .public (parser compiler) (-> Lux (Parser Definition)) (do [! <>.monad] @@ -115,11 +78,6 @@ .local_identifier (<>.or //check.parser .any) - (<| .tuple - (<>.after .any) - .form - (<>.after (.this! (` #.Record))) - ..annotations_parser) .bit )))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index 37ccff163..251a543a3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -23,7 +23,7 @@ (def: .public writer (Writer .Module) (let [definition (: (Writer Definition) - ($_ _.and _.bit _.type _.code _.any)) + ($_ _.and _.bit _.type _.any)) labels (: (Writer [Text (List Text)]) (_.and _.text (_.list _.text))) global_type (: (Writer [Bit Type (Either [Text (List Text)] @@ -57,7 +57,7 @@ (def: .public parser (Parser .Module) (let [definition (: (Parser Definition) - ($_ <>.and .bit .type .code .any)) + ($_ <>.and .bit .type .any)) labels (: (Parser [Text (List Text)]) (<>.and .text (.list .text))) global_type (: (Parser [Bit Type (Either [Text (List Text)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index b38712c22..33b1c7e32 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -42,7 +42,7 @@ (#.Alias real_def_name) (definition real_def_name) - (#.Definition [exported? actualT def_anns _]) + (#.Definition [exported? actualT _]) (do ! [_ (//type.infer actualT) (^@ def_name [::module ::name]) (///extension.lifted (meta.normal def_name)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index bf517b526..a8e9ae29f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -214,7 +214,7 @@ (do ! [input_type (///.lifted (meta.definition (name_of .Macro')))] (case input_type - (^or (#.Definition [exported? def_type def_data def_value]) + (^or (#.Definition [exported? def_type def_value]) (#.Type [exported? def_value labels])) (in (:as Type def_value)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index c9a050c6d..1da688392 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -219,16 +219,15 @@ (-> Expander /////analysis.Bundle Handler) (function (_ extension_name phase archive inputsC+) (case inputsC+ - (^ (list [_ (#.Identifier ["" short_name])] valueC annotationsC exported?C)) + (^ (list [_ (#.Identifier ["" short_name])] valueC exported?C)) (do phase.monad [current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [type valueT value] (..definition archive full_name #.None valueC) [_ _ exported?] (evaluate! archive Bit exported?C) - [_ _ annotations] (evaluate! archive Code annotationsC) _ (/////directive.lifted_analysis - (module.define short_name (#.Definition [(:as Bit exported?) type (:as Code annotations) value]))) + (module.define short_name (#.Definition [(:as Bit exported?) type value]))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] (in /////directive.no_requirements)) @@ -248,19 +247,17 @@ (def: (def::type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) (..custom - [($_ <>.and .local_identifier .any .any + [($_ <>.and .local_identifier .any (<>.or (.form (<>.some .text)) (.tuple (<>.some .text))) .any) - (function (_ extension_name phase archive [short_name valueC annotationsC labels exported?C]) + (function (_ extension_name phase archive [short_name valueC labels exported?C]) (do phase.monad [current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [_ _ exported?] (evaluate! archive Bit exported?C) - [_ _ annotations] (evaluate! archive Code annotationsC) - .let [exported? (:as Bit exported?) - annotations (:as Code annotations)] + .let [exported? (:as Bit exported?)] [type valueT value] (..definition archive full_name (#.Some .Type) valueC) labels (/////directive.lifted_analysis (do phase.monad @@ -272,7 +269,7 @@ [true slots])] _ (case labels #.End - (module.define short_name (#.Definition [exported? type annotations value])) + (module.define short_name (#.Definition [exported? type value])) (#.Item labels) (module.define short_name (#.Type [exported? (:as .Type value) (if record? @@ -294,21 +291,17 @@ (def: def::module Handler (..custom - [($_ <>.and .any ..imports) - (function (_ extension_name phase archive [annotationsC imports]) + [..imports + (function (_ extension_name phase archive imports) (do [! phase.monad] - [[_ _ annotationsV] (evaluate! archive Code annotationsC) - .let [annotationsV (:as Code annotationsV)] - _ (/////directive.lifted_analysis - (do ! - [_ (monad.each ! (function (_ [module alias]) - (do ! - [_ (module.import module)] - (case alias - "" (in []) - _ (module.alias alias module)))) - imports)] - (module.set_annotations annotationsV)))] + [_ (/////directive.lifted_analysis + (monad.each ! (function (_ [module alias]) + (do ! + [_ (module.import module)] + (case alias + "" (in []) + _ (module.alias alias module)))) + imports))] (in [#/////directive.imports imports #/////directive.referrals (list)])))])) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index cdd999306..d6a427d0b 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -330,11 +330,11 @@ [#.Label] [#.Slot]) - (#.Definition [exported? type annotations _]) + (#.Definition [exported? type _]) (|> definitions (dictionary.value def_name) try.of_maybe - (\ ! each (|>> [exported? type annotations] + (\ ! each (|>> [exported? type] #.Definition [def_name]))) -- cgit v1.2.3