From 72950a540be3dc49a107700c77c0195db16a4f58 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 23 May 2018 02:04:47 -0400 Subject: - Migrated special-form analysis to stdlib. --- new-luxc/source/luxc/lang/extension.lux | 114 -------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/extension.lux (limited to 'new-luxc/source/luxc/lang/extension.lux') diff --git a/new-luxc/source/luxc/lang/extension.lux b/new-luxc/source/luxc/lang/extension.lux deleted file mode 100644 index 254dd18ca..000000000 --- a/new-luxc/source/luxc/lang/extension.lux +++ /dev/null @@ -1,114 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do] - ["ex" exception #+ exception:]) - (data ["e" error] - [text] - (coll (dictionary ["dict" unordered #+ Dict]))) - [macro]) - [//] - (// ["la" analysis] - ["ls" synthesis])) - -(do-template [] - [(exception: #export ( {message Text}) - message)] - - [Unknown-Analysis] - [Unknown-Synthesis] - [Unknown-Translation] - [Unknown-Statement] - - [Cannot-Define-Analysis-More-Than-Once] - [Cannot-Define-Synthesis-More-Than-Once] - [Cannot-Define-Translation-More-Than-Once] - [Cannot-Define-Statement-More-Than-Once] - ) - -(type: #export Analysis - (-> (-> Code (Meta Code)) - (-> Type Code (Meta Any)) - (List Code) (Meta Code))) - -(type: #export Synthesis - (-> (-> la.Analysis ls.Synthesis) (List Code) Code)) - -(type: #export Syntheses (Dict Text Synthesis)) - -(type: #export Translation - (-> (List Code) (Meta Code))) - -(type: #export Statement - (-> (List Code) (Meta Any))) - -(type: #export Extensions - {#analysis (Dict Text Analysis) - #synthesis Syntheses - #translation (Dict Text Translation) - #statement (Dict Text Statement)}) - -(def: #export fresh - Extensions - {#analysis (dict.new text.Hash) - #synthesis (dict.new text.Hash) - #translation (dict.new text.Hash) - #statement (dict.new text.Hash)}) - -(def: get - (Meta Extensions) - (function (_ compiler) - (#e.Success [compiler - (|> compiler (get@ #.extensions) (:! Extensions))]))) - -(def: (set extensions) - (-> Extensions (Meta Any)) - (function (_ compiler) - (#e.Success [(set@ #.extensions (:! Nothing extensions) compiler) - []]))) - -(do-template [ ] - [(def: #export ( name) - (-> Text (Meta )) - (do macro.Monad - [extensions ..get] - (case (dict.get name (get@ extensions)) - (#.Some extension) - (wrap extension) - - #.None - (//.throw name))))] - - [find-analysis Analysis #analysis Unknown-Analysis] - [find-synthesis Synthesis #synthesis Unknown-Synthesis] - [find-translation Translation #translation Unknown-Translation] - [find-statement Statement #statement Unknown-Statement] - ) - -(do-template [ ] - [(def: #export - - ) - - (def: #export - (Meta ) - (|> ..get - (:: macro.Monad map (get@ ))))] - - [no-syntheses all-syntheses Syntheses #synthesis (dict.new text.Hash)] - ) - -(do-template [ ] - [(def: #export ( name extension) - (-> Text (Meta Any)) - (do macro.Monad - [extensions ..get - _ (//.assert name - (not (dict.contains? name (get@ extensions)))) - _ (..set (update@ (dict.put name extension) extensions))] - (wrap [])))] - - [install-analysis Analysis #analysis Cannot-Define-Analysis-More-Than-Once] - [install-synthesis Synthesis #synthesis Cannot-Define-Synthesis-More-Than-Once] - [install-translation Translation #translation Cannot-Define-Translation-More-Than-Once] - [install-statement Statement #statement Cannot-Define-Statement-More-Than-Once] - ) -- cgit v1.2.3