aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool
diff options
context:
space:
mode:
authorEduardo Julian2020-12-25 09:22:38 -0400
committerEduardo Julian2020-12-25 09:22:38 -0400
commit4ca397765805eda5ddee393901ed3a02001a960a (patch)
tree2ab184a1a4e244f3a69e86c8a7bb3ad49c22b4a3 /stdlib/source/lux/tool
parentd29e091e98dabb8dfcf816899ada480ecbf7e357 (diff)
Replaced kebab-case with snake_case for naming convention.
Diffstat (limited to 'stdlib/source/lux/tool')
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/analysis.lux138
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/directive.lux20
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/generation.lux94
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/analysis/type.lux26
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux12
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/syntax.lux386
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/synthesis.lux258
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive.lux56
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/artifact.lux6
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/meta/io.lux4
-rw-r--r--stdlib/source/lux/tool/compiler/meta/io/context.lux62
-rw-r--r--stdlib/source/lux/tool/compiler/phase.lux4
13 files changed, 534 insertions, 534 deletions
diff --git a/stdlib/source/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/lux/tool/compiler/language/lux/analysis.lux
index e6fea4ef1..619f3c1d5 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/analysis.lux
@@ -105,7 +105,7 @@
(type: #export Match
(Match' Analysis))
-(structure: primitive-equivalence
+(structure: primitive_equivalence
(Equivalence Primitive)
(def: (= reference sample)
@@ -126,16 +126,16 @@
_
false)))
-(structure: #export (composite-equivalence (^open "/\."))
+(structure: #export (composite_equivalence (^open "/\."))
(All [a] (-> (Equivalence a) (Equivalence (Composite a))))
(def: (= reference sample)
(case [reference sample]
- [(#Variant [reference-lefts reference-right? reference-value])
- (#Variant [sample-lefts sample-right? sample-value])]
- (and (n.= reference-lefts sample-lefts)
- (bit\= reference-right? sample-right?)
- (/\= reference-value sample-value))
+ [(#Variant [reference_lefts reference_right? reference_value])
+ (#Variant [sample_lefts sample_right? sample_value])]
+ (and (n.= reference_lefts sample_lefts)
+ (bit\= reference_right? sample_right?)
+ (/\= reference_value sample_value))
[(#Tuple reference) (#Tuple sample)]
(\ (list.equivalence /\=) = reference sample)
@@ -143,11 +143,11 @@
_
false)))
-(structure: #export (composite-hash super)
+(structure: #export (composite_hash super)
(All [a] (-> (Hash a) (Hash (Composite a))))
(def: &equivalence
- (..composite-equivalence (\ super &equivalence)))
+ (..composite_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
@@ -162,16 +162,16 @@
(\ (list.hash super) hash members))
)))
-(structure: pattern-equivalence
+(structure: pattern_equivalence
(Equivalence Pattern)
(def: (= reference sample)
(case [reference sample]
[(#Simple reference) (#Simple sample)]
- (\ primitive-equivalence = reference sample)
+ (\ primitive_equivalence = reference sample)
[(#Complex reference) (#Complex sample)]
- (\ (composite-equivalence =) = reference sample)
+ (\ (composite_equivalence =) = reference sample)
[(#Bind reference) (#Bind sample)]
(n.= reference sample)
@@ -179,12 +179,12 @@
_
false)))
-(structure: (branch-equivalence equivalence)
+(structure: (branch_equivalence equivalence)
(-> (Equivalence Analysis) (Equivalence Branch))
- (def: (= [reference-pattern reference-body] [sample-pattern sample-body])
- (and (\ pattern-equivalence = reference-pattern sample-pattern)
- (\ equivalence = reference-body sample-body))))
+ (def: (= [reference_pattern reference_body] [sample_pattern sample_body])
+ (and (\ pattern_equivalence = reference_pattern sample_pattern)
+ (\ equivalence = reference_body sample_body))))
(structure: #export equivalence
(Equivalence Analysis)
@@ -192,28 +192,28 @@
(def: (= reference sample)
(case [reference sample]
[(#Primitive reference) (#Primitive sample)]
- (\ primitive-equivalence = reference sample)
+ (\ primitive_equivalence = reference sample)
[(#Structure reference) (#Structure sample)]
- (\ (composite-equivalence =) = reference sample)
+ (\ (composite_equivalence =) = reference sample)
[(#Reference reference) (#Reference sample)]
(\ reference.equivalence = reference sample)
- [(#Case [reference-analysis reference-match])
- (#Case [sample-analysis sample-match])]
- (and (= reference-analysis sample-analysis)
- (\ (list.equivalence (branch-equivalence =)) = (#.Cons reference-match) (#.Cons sample-match)))
+ [(#Case [reference_analysis reference_match])
+ (#Case [sample_analysis sample_match])]
+ (and (= reference_analysis sample_analysis)
+ (\ (list.equivalence (branch_equivalence =)) = (#.Cons reference_match) (#.Cons sample_match)))
- [(#Function [reference-environment reference-analysis])
- (#Function [sample-environment sample-analysis])]
- (and (= reference-analysis sample-analysis)
- (\ (list.equivalence =) = reference-environment sample-environment))
+ [(#Function [reference_environment reference_analysis])
+ (#Function [sample_environment sample_analysis])]
+ (and (= reference_analysis sample_analysis)
+ (\ (list.equivalence =) = reference_environment sample_environment))
- [(#Apply [reference-input reference-abstraction])
- (#Apply [sample-input sample-abstraction])]
- (and (= reference-input sample-input)
- (= reference-abstraction sample-abstraction))
+ [(#Apply [reference_input reference_abstraction])
+ (#Apply [sample_input sample_abstraction])]
+ (and (= reference_input sample_input)
+ (= reference_abstraction sample_abstraction))
[(#Extension reference) (#Extension sample)]
(\ (extension.equivalence =) = reference sample)
@@ -253,7 +253,7 @@
(-> Nat Tag Bit)
(n.= (dec size) tag))
-(template: #export (no-op value)
+(template: #export (no_op value)
(|> 1 #variable.Local #reference.Variable #..Reference
(#..Function (list))
(#..Apply value)))
@@ -353,7 +353,7 @@
(#Tuple members)
(|> members
(list\map %analysis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"])))
(#Reference reference)
@@ -367,7 +367,7 @@
(format " ")
(format (|> environment
(list\map %analysis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"])))
(text.enclose ["(" ")"]))
@@ -376,13 +376,13 @@
..application
#.Cons
(list\map %analysis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["(" ")"]))
(#Extension name parameters)
(|> parameters
(list\map %analysis)
- (text.join-with " ")
+ (text.join_with " ")
(format (%.text name) " ")
(text.enclose ["(" ")"]))))
@@ -397,34 +397,34 @@
[Bundle extension.Bundle]
)
-(def: #export (with-source-code source action)
+(def: #export (with_source_code source action)
(All [a] (-> Source (Operation a) (Operation a)))
(function (_ [bundle state])
- (let [old-source (get@ #.source state)]
+ (let [old_source (get@ #.source state)]
(case (action [bundle (set@ #.source source state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (set@ #.source old-source state')]
+ (#try.Success [[bundle' (set@ #.source old_source state')]
output])
(#try.Failure error)
(#try.Failure error)))))
-(def: fresh-bindings
+(def: fresh_bindings
(All [k v] (Bindings k v))
{#.counter 0
#.mappings (list)})
-(def: fresh-scope
+(def: fresh_scope
Scope
{#.name (list)
#.inner 0
- #.locals fresh-bindings
- #.captured fresh-bindings})
+ #.locals fresh_bindings
+ #.captured fresh_bindings})
-(def: #export (with-scope action)
+(def: #export (with_scope action)
(All [a] (-> (Operation a) (Operation [Scope a])))
(function (_ [bundle state])
- (case (action [bundle (update@ #.scopes (|>> (#.Cons fresh-scope)) state)])
+ (case (action [bundle (update@ #.scopes (|>> (#.Cons fresh_scope)) state)])
(#try.Success [[bundle' state'] output])
(case (get@ #.scopes state')
(#.Cons head tail)
@@ -437,35 +437,35 @@
(#try.Failure error)
(#try.Failure error))))
-(def: #export (with-current-module name)
+(def: #export (with_current_module name)
(All [a] (-> Text (Operation a) (Operation a)))
- (extension.localized (get@ #.current-module)
- (set@ #.current-module)
+ (extension.localized (get@ #.current_module)
+ (set@ #.current_module)
(function.constant (#.Some name))))
-(def: #export (with-location location action)
+(def: #export (with_location location action)
(All [a] (-> Location (Operation a) (Operation a)))
(if (text\= "" (product.left location))
action
(function (_ [bundle state])
- (let [old-location (get@ #.location state)]
+ (let [old_location (get@ #.location state)]
(case (action [bundle (set@ #.location location state)])
(#try.Success [[bundle' state'] output])
- (#try.Success [[bundle' (set@ #.location old-location state')]
+ (#try.Success [[bundle' (set@ #.location old_location state')]
output])
(#try.Failure error)
(#try.Failure error))))))
-(def: (locate-error location error)
+(def: (locate_error location error)
(-> Location Text Text)
- (format "@ " (%.location location) text.new-line
+ (format "@ " (%.location location) text.new_line
error))
(def: #export (fail error)
(-> Text Operation)
(function (_ [bundle state])
- (#try.Failure (locate-error (get@ #.location state) error))))
+ (#try.Failure (locate_error (get@ #.location state) error))))
(def: #export (throw exception parameters)
(All [e] (-> (Exception e) e Operation))
@@ -480,13 +480,13 @@
(def: #export (fail' error)
(-> Text (phase.Operation Lux))
(function (_ state)
- (#try.Failure (locate-error (get@ #.location state) error))))
+ (#try.Failure (locate_error (get@ #.location state) error))))
(def: #export (throw' exception parameters)
(All [e] (-> (Exception e) e (phase.Operation Lux)))
(..fail' (exception.construct exception parameters)))
-(def: #export (with-stack exception message action)
+(def: #export (with_stack exception message action)
(All [e o] (-> (Exception e) e (Operation o) (Operation o)))
(function (_ bundle,state)
(case (exception.with exception message
@@ -496,7 +496,7 @@
(#try.Failure error)
(let [[bundle state] bundle,state]
- (#try.Failure (locate-error (get@ #.location state) error))))))
+ (#try.Failure (locate_error (get@ #.location state) error))))))
(def: #export (install state)
(-> .Lux (Operation Any))
@@ -509,9 +509,9 @@
(-> <type> (Operation Any))
(extension.update (set@ <field> <value>)))]
- [set-source-code Source #.source value]
- [set-current-module Text #.current-module (#.Some value)]
- [set-location Location #.location value]
+ [set_source_code Source #.source value]
+ [set_current_module Text #.current_module (#.Some value)]
+ [set_location Location #.location value]
)
(def: #export (location file)
@@ -522,15 +522,15 @@
(-> Text Text Source)
[(location file) 0 code])
-(def: dummy-source
+(def: dummy_source
Source
[location.dummy 0 ""])
-(def: type-context
- Type-Context
- {#.ex-counter 0
- #.var-counter 0
- #.var-bindings (list)})
+(def: type_context
+ Type_Context
+ {#.ex_counter 0
+ #.var_counter 0
+ #.var_bindings (list)})
(def: #export (info version host)
(-> Version Text Info)
@@ -541,14 +541,14 @@
(def: #export (state info)
(-> Info Lux)
{#.info info
- #.source ..dummy-source
+ #.source ..dummy_source
#.location location.dummy
- #.current-module #.None
+ #.current_module #.None
#.modules (list)
#.scopes (list)
- #.type-context ..type-context
+ #.type_context ..type_context
#.expected #.None
#.seed 0
- #.scope-type-vars (list)
+ #.scope_type_vars (list)
#.extensions []
#.host []})
diff --git a/stdlib/source/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/lux/tool/compiler/language/lux/directive.lux
index 788b8fc4a..896a9a1cb 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/directive.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/directive.lux
@@ -37,12 +37,12 @@
{#imports (List Import)
#referrals (List Code)})
-(def: #export no-requirements
+(def: #export no_requirements
Requirements
{#imports (list)
#referrals (list)})
-(def: #export (merge-requirements left right)
+(def: #export (merge_requirements left right)
(-> Requirements Requirements Requirements)
{#imports (list\compose (get@ #imports left) (get@ #imports right))
#referrals (list\compose (get@ #referrals left) (get@ #referrals right))})
@@ -67,16 +67,16 @@
(set@ [<component> #..state])])
extension.lift))]
- [lift-analysis #..analysis analysis.Operation]
- [lift-synthesis #..synthesis synthesis.Operation]
- [lift-generation #..generation (generation.Operation anchor expression directive)]
+ [lift_analysis #..analysis analysis.Operation]
+ [lift_synthesis #..synthesis synthesis.Operation]
+ [lift_generation #..generation (generation.Operation anchor expression directive)]
)
-(def: #export (set-current-module module)
+(def: #export (set_current_module module)
(All [anchor expression directive]
(-> Module (Operation anchor expression directive Any)))
(do phase.monad
- [_ (..lift-analysis
- (analysis.set-current-module module))]
- (..lift-generation
- (generation.enter-module module))))
+ [_ (..lift_analysis
+ (analysis.set_current_module module))]
+ (..lift_generation
+ (generation.enter_module module))))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/lux/tool/compiler/language/lux/generation.lux
index da24f66f3..85a9ded21 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/generation.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/generation.lux
@@ -31,7 +31,7 @@
(type: #export Context [archive.ID artifact.ID])
(type: #export (Buffer directive) (Row [Text directive]))
-(exception: #export (cannot-interpret {error Text})
+(exception: #export (cannot_interpret {error Text})
(exception.report
["Error" error]))
@@ -40,8 +40,8 @@
(exception.report
["Output" (%.text name)]))]
- [cannot-overwrite-output]
- [no-buffer-for-saving-code]
+ [cannot_overwrite_output]
+ [no_buffer_for_saving_code]
)
(signature: #export (Host expression directive)
@@ -55,9 +55,9 @@
(: (-> Context Binary directive)
ingest)
(: (-> Context directive (Try Any))
- re-learn)
+ re_learn)
(: (-> Context directive (Try Any))
- re-load))
+ re_load))
(type: #export (State anchor expression directive)
{#module Module
@@ -95,18 +95,18 @@
#context #.None
#log row.empty})
-(def: #export empty-buffer Buffer row.empty)
+(def: #export empty_buffer Buffer row.empty)
(template [<tag>
- <with-declaration> <with-type> <with-value>
- <set> <get> <get-type> <exception>]
+ <with_declaration> <with_type> <with_value>
+ <set> <get> <get_type> <exception>]
[(exception: #export <exception>)
- (def: #export <with-declaration>
- (All [anchor expression directive output] <with-type>)
+ (def: #export <with_declaration>
+ (All [anchor expression directive output] <with_type>)
(function (_ body)
(function (_ [bundle state])
- (case (body [bundle (set@ <tag> (#.Some <with-value>) state)])
+ (case (body [bundle (set@ <tag> (#.Some <with_value>) state)])
(#try.Success [[bundle' state'] output])
(#try.Success [[bundle' (set@ <tag> (get@ <tag> state) state')]
output])
@@ -116,7 +116,7 @@
(def: #export <get>
(All [anchor expression directive]
- (Operation anchor expression directive <get-type>))
+ (Operation anchor expression directive <get_type>))
(function (_ (^@ stateE [bundle state]))
(case (get@ <tag> state)
(#.Some output)
@@ -127,33 +127,33 @@
(def: #export (<set> value)
(All [anchor expression directive]
- (-> <get-type> (Operation anchor expression directive Any)))
+ (-> <get_type> (Operation anchor expression directive Any)))
(function (_ [bundle state])
(#try.Success [[bundle (set@ <tag> (#.Some value) state)]
[]])))]
[#anchor
- (with-anchor anchor)
+ (with_anchor anchor)
(-> anchor (Operation anchor expression directive output)
(Operation anchor expression directive output))
anchor
- set-anchor anchor anchor no-anchor]
+ set_anchor anchor anchor no_anchor]
[#buffer
- with-buffer
+ with_buffer
(-> (Operation anchor expression directive output)
(Operation anchor expression directive output))
- ..empty-buffer
- set-buffer buffer (Buffer directive) no-active-buffer]
+ ..empty_buffer
+ set_buffer buffer (Buffer directive) no_active_buffer]
)
-(def: #export get-registry
+(def: #export get_registry
(All [anchor expression directive]
(Operation anchor expression directive artifact.Registry))
(function (_ (^@ stateE [bundle state]))
(#try.Success [stateE (get@ #registry state)])))
-(def: #export (set-registry value)
+(def: #export (set_registry value)
(All [anchor expression directive]
(-> artifact.Registry (Operation anchor expression directive Any)))
(function (_ [bundle state])
@@ -173,7 +173,7 @@
(-> Text (Operation anchor expression directive Text)))
(\ phase.monad map (|>> %.nat (format prefix)) ..next))
-(def: #export (enter-module module)
+(def: #export (enter_module module)
(All [anchor expression directive]
(-> Module (Operation anchor expression directive Any)))
(extension.update (set@ #module module)))
@@ -192,7 +192,7 @@
(#try.Success [state+ output])
(#try.Failure error)
- (exception.throw ..cannot-interpret error))))
+ (exception.throw ..cannot_interpret error))))
(def: #export (execute! code)
(All [anchor expression directive]
@@ -203,7 +203,7 @@
(#try.Success [state+ output])
(#try.Failure error)
- (exception.throw ..cannot-interpret error))))
+ (exception.throw ..cannot_interpret error))))
(def: #export (define! context code)
(All [anchor expression directive]
@@ -214,7 +214,7 @@
(#try.Success [stateE output])
(#try.Failure error)
- (exception.throw ..cannot-interpret error))))
+ (exception.throw ..cannot_interpret error))))
(def: #export (save! name code)
(All [anchor expression directive]
@@ -224,11 +224,11 @@
(case ?buffer
(#.Some buffer)
(if (row.any? (|>> product.left (text\= name)) buffer)
- (phase.throw ..cannot-overwrite-output [name])
+ (phase.throw ..cannot_overwrite_output [name])
(extension.update (set@ #buffer (#.Some (row.add [name code] buffer)))))
#.None
- (phase.throw ..no-buffer-for-saving-code [name]))))
+ (phase.throw ..no_buffer_for_saving_code [name]))))
(template [<name> <artifact>]
[(def: #export (<name> name)
@@ -240,18 +240,18 @@
id]))))]
[learn artifact.definition]
- [learn-analyser artifact.analyser]
- [learn-synthesizer artifact.synthesizer]
- [learn-generator artifact.generator]
- [learn-directive artifact.directive]
+ [learn_analyser artifact.analyser]
+ [learn_synthesizer artifact.synthesizer]
+ [learn_generator artifact.generator]
+ [learn_directive artifact.directive]
)
-(exception: #export (unknown-definition {name Name}
- {known-definitions (List Text)})
+(exception: #export (unknown_definition {name Name}
+ {known_definitions (List Text)})
(exception.report
["Definition" (name.short name)]
["Module" (name.module name)]
- ["Known Definitions" (exception.enumerate function.identity known-definitions)]))
+ ["Known Definitions" (exception.enumerate function.identity known_definitions)]))
(def: #export (remember archive name)
(All [anchor expression directive]
@@ -259,7 +259,7 @@
(function (_ (^@ stateE [bundle state]))
(let [[_module _name] name]
(do try.monad
- [module-id (archive.id _module archive)
+ [module_id (archive.id _module archive)
registry (if (text\= (get@ #module state) _module)
(#try.Success (get@ #registry state))
(do try.monad
@@ -267,20 +267,20 @@
(#try.Success (get@ #descriptor.registry descriptor))))]
(case (artifact.remember _name registry)
#.None
- (exception.throw ..unknown-definition [name (artifact.definitions registry)])
+ (exception.throw ..unknown_definition [name (artifact.definitions registry)])
(#.Some id)
- (#try.Success [stateE [module-id id]]))))))
+ (#try.Success [stateE [module_id id]]))))))
-(exception: #export no-context)
+(exception: #export no_context)
-(def: #export (module-id module archive)
+(def: #export (module_id module archive)
(All [anchor expression directive]
(-> Module Archive (Operation anchor expression directive archive.ID)))
(function (_ (^@ stateE [bundle state]))
(do try.monad
- [module-id (archive.id module archive)]
- (wrap [stateE module-id]))))
+ [module_id (archive.id module archive)]
+ (wrap [stateE module_id]))))
(def: #export (context archive)
(All [anchor expression directive]
@@ -288,14 +288,14 @@
(function (_ (^@ stateE [bundle state]))
(case (get@ #context state)
#.None
- (exception.throw ..no-context [])
+ (exception.throw ..no_context [])
(#.Some id)
(do try.monad
- [module-id (archive.id (get@ #module state) archive)]
- (wrap [stateE [module-id id]])))))
+ [module_id (archive.id (get@ #module state) archive)]
+ (wrap [stateE [module_id id]])))))
-(def: #export (with-context id body)
+(def: #export (with_context id body)
(All [anchor expression directive a]
(-> artifact.ID
(Operation anchor expression directive a)
@@ -306,7 +306,7 @@
(wrap [[bundle' (set@ #context (get@ #context state) state')]
output]))))
-(def: #export (with-new-context archive body)
+(def: #export (with_new_context archive body)
(All [anchor expression directive a]
(-> Archive (Operation anchor expression directive a)
(Operation anchor expression directive [Context a])))
@@ -316,9 +316,9 @@
[[[bundle' state'] output] (body [bundle (|> state
(set@ #registry registry')
(set@ #context (#.Some id)))])
- module-id (archive.id (get@ #module state) archive)]
+ module_id (archive.id (get@ #module state) archive)]
(wrap [[bundle' (set@ #context (get@ #context state) state')]
- [[module-id id]
+ [[module_id id]
output]])))))
(def: #export (log! message)
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/type.lux
index 5d5aa835d..f72ec593b 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/type.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/type.lux
@@ -15,41 +15,41 @@
[///
["#" phase]]]])
-(def: #export (with-type expected)
+(def: #export (with_type expected)
(All [a] (-> Type (Operation a) (Operation a)))
(///extension.localized (get@ #.expected) (set@ #.expected)
(function.constant (#.Some expected))))
-(def: #export (with-env action)
+(def: #export (with_env action)
(All [a] (-> (Check a) (Operation a)))
(function (_ (^@ stateE [bundle state]))
- (case (action (get@ #.type-context state))
+ (case (action (get@ #.type_context state))
(#try.Success [context' output])
- (#try.Success [[bundle (set@ #.type-context context' state)]
+ (#try.Success [[bundle (set@ #.type_context context' state)]
output])
(#try.Failure error)
((/.fail error) stateE))))
-(def: #export with-fresh-env
+(def: #export with_fresh_env
(All [a] (-> (Operation a) (Operation a)))
- (///extension.localized (get@ #.type-context) (set@ #.type-context)
- (function.constant check.fresh-context)))
+ (///extension.localized (get@ #.type_context) (set@ #.type_context)
+ (function.constant check.fresh_context)))
(def: #export (infer actualT)
(-> Type (Operation Any))
(do ///.monad
- [expectedT (///extension.lift meta.expected-type)]
- (with-env
+ [expectedT (///extension.lift meta.expected_type)]
+ (with_env
(check.check expectedT actualT))))
-(def: #export (with-inference action)
+(def: #export (with_inference action)
(All [a] (-> (Operation a) (Operation [Type a])))
(do ///.monad
- [[_ varT] (..with-env
+ [[_ varT] (..with_env
check.var)
- output (with-type varT
+ output (with_type varT
action)
- knownT (..with-env
+ knownT (..with_env
(check.clean varT))]
(wrap [knownT output])))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux
index f121b78ca..9803de0e4 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux
@@ -36,7 +36,7 @@
(|>> list.hash
(product.hash text.hash)))
-(with-expansions [<Bundle> (as-is (Dictionary Name (Handler s i o)))]
+(with_expansions [<Bundle> (as_is (Dictionary Name (Handler s i o)))]
(type: #export (Handler s i o)
(-> Name
(//.Phase [<Bundle> s] i o)
@@ -55,17 +55,17 @@
(type: #export (Phase s i o)
(//.Phase (State s i o) i o))
-(exception: #export (cannot-overwrite {name Name})
+(exception: #export (cannot_overwrite {name Name})
(exception.report
["Extension" (%.text name)]))
-(exception: #export (incorrect-arity {name Name} {arity Nat} {args Nat})
+(exception: #export (incorrect_arity {name Name} {arity Nat} {args Nat})
(exception.report
["Extension" (%.text name)]
["Expected" (%.nat arity)]
["Actual" (%.nat args)]))
-(exception: #export [a] (invalid-syntax {name Name} {%format (Format a)} {inputs (List a)})
+(exception: #export [a] (invalid_syntax {name Name} {%format (Format a)} {inputs (List a)})
(exception.report
["Extension" (%.text name)]
["Inputs" (exception.enumerate %format inputs)]))
@@ -91,7 +91,7 @@
[]])
_
- (exception.throw ..cannot-overwrite name))))
+ (exception.throw ..cannot_overwrite name))))
(def: #export (with extender extensions)
(All [s i o]
@@ -142,7 +142,7 @@
(#try.Failure error)
(#try.Failure error)))))
-(def: #export (with-state state)
+(def: #export (with_state state)
(All [s i o v]
(-> s (-> (Operation s i o v) (Operation s i o v))))
(..temporary (function.constant state)))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/lux/tool/compiler/language/lux/syntax.lux
index 1916cfe15..bdbba5134 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/syntax.lux
@@ -93,37 +93,37 @@
(type: #export Aliases
(Dictionary Text Text))
-(def: #export no-aliases
+(def: #export no_aliases
Aliases
(dictionary.new text.hash))
(def: #export prelude "lux")
-(def: #export text-delimiter text.double-quote)
+(def: #export text_delimiter text.double_quote)
(template [<char> <definition>]
[(def: #export <definition> <char>)]
## Form delimiters
- ["(" open-form]
- [")" close-form]
+ ["(" open_form]
+ [")" close_form]
## Tuple delimiters
- ["[" open-tuple]
- ["]" close-tuple]
+ ["[" open_tuple]
+ ["]" close_tuple]
## Record delimiters
- ["{" open-record]
- ["}" close-record]
+ ["{" open_record]
+ ["}" close_record]
["#" sigil]
- ["," digit-separator]
+ ["," digit_separator]
- ["+" positive-sign]
- ["-" negative-sign]
+ ["+" positive_sign]
+ ["-" negative_sign]
- ["." frac-separator]
+ ["." frac_separator]
## The parts of a name are separated by a single mark.
## E.g. module.short.
@@ -132,52 +132,52 @@
## mark], and the short [after the mark]).
## There are also some extra rules regarding name syntax,
## encoded in the parser.
- ["." name-separator]
+ ["." name_separator]
)
-(exception: #export (end-of-file {module Text})
+(exception: #export (end_of_file {module Text})
(exception.report
["Module" (%.text module)]))
-(def: amount-of-input-shown 64)
+(def: amount_of_input_shown 64)
-(template: (input-at start input)
+(template: (input_at start input)
## (-> Offset Text Text)
- (let [end (|> start (!n/+ amount-of-input-shown) (n.min ("lux text size" input)))]
+ (let [end (|> start (!n/+ amount_of_input_shown) (n.min ("lux text size" input)))]
(!clip start end input)))
-(exception: #export (unrecognized-input {[file line column] Location} {context Text} {input Text} {offset Offset})
+(exception: #export (unrecognized_input {[file line column] Location} {context Text} {input Text} {offset Offset})
(exception.report
["File" file]
["Line" (%.nat line)]
["Column" (%.nat column)]
["Context" (%.text context)]
- ["Input" (input-at offset input)]))
+ ["Input" (input_at offset input)]))
-(exception: #export (text-cannot-contain-new-lines {text Text})
+(exception: #export (text_cannot_contain_new_lines {text Text})
(exception.report
["Text" (%.text text)]))
-(template: (!failure parser where offset source-code)
- (#.Left [[where offset source-code]
- (exception.construct ..unrecognized-input [where (%.name (name-of parser)) source-code offset])]))
+(template: (!failure parser where offset source_code)
+ (#.Left [[where offset source_code]
+ (exception.construct ..unrecognized_input [where (%.name (name_of parser)) source_code offset])]))
-(template: (!end-of-file where offset source-code current-module)
- (#.Left [[where offset source-code]
- (exception.construct ..end-of-file current-module)]))
+(template: (!end_of_file where offset source_code current_module)
+ (#.Left [[where offset source_code]
+ (exception.construct ..end_of_file current_module)]))
(type: (Parser a)
(-> Source (Either [Source Text] [Source a])))
-(template: (!with-char+ @source-code-size @source-code @offset @char @else @body)
- (if (!i/< (:coerce Int @source-code-size)
+(template: (!with_char+ @source_code_size @source_code @offset @char @else @body)
+ (if (!i/< (:coerce Int @source_code_size)
(:coerce Int @offset))
- (let [@char ("lux text char" @offset @source-code)]
+ (let [@char ("lux text char" @offset @source_code)]
@body)
@else))
-(template: (!with-char @source-code @offset @char @else @body)
- (!with-char+ ("lux text size" @source-code) @source-code @offset @char @else @body))
+(template: (!with_char @source_code @offset @char @else @body)
+ (!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body))
(template: (!letE <binding> <computation> <body>)
(case <computation>
@@ -188,12 +188,12 @@
<<otherwise>>
(:assume <<otherwise>>)))
-(template: (!horizontal where offset source-code)
+(template: (!horizontal where offset source_code)
[(update@ #.column inc where)
(!inc offset)
- source-code])
+ source_code])
-(template: (!new-line where)
+(template: (!new_line where)
## (-> Location Location)
(let [[where::file where::line where::column] where]
[where::file (!inc where::line) 0]))
@@ -203,15 +203,15 @@
(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ length where::column)]))
-(template: (!vertical where offset source-code)
- [(!new-line where)
+(template: (!vertical where offset source_code)
+ [(!new_line where)
(!inc offset)
- source-code])
+ source_code])
(template [<name> <close> <tag>]
- [(template: (<name> parse where offset source-code)
+ [(template: (<name> parse where offset source_code)
## (-> (Parser Code) (Parser Code))
- (loop [source (: Source [(!forward 1 where) offset source-code])
+ (loop [source (: Source [(!forward 1 where) offset source_code])
stack (: (List Code) #.Nil)]
(case (parse source)
(#.Right [source' top])
@@ -226,13 +226,13 @@
## Form and tuple syntax is mostly the same, differing only in the
## delimiters involved.
## They may have an arbitrary number of arbitrary Code nodes as elements.
- [parse-form ..close-form #.Form]
- [parse-tuple ..close-tuple #.Tuple]
+ [parse_form ..close_form #.Form]
+ [parse_tuple ..close_tuple #.Tuple]
)
-(template: (parse-record parse where offset source-code)
+(template: (parse_record parse where offset source_code)
## (-> (Parser Code) (Parser Code))
- (loop [source (: Source [(!forward 1 where) offset source-code])
+ (loop [source (: Source [(!forward 1 where) offset source_code])
stack (: (List [Code Code]) #.Nil)]
(case (parse source)
(#.Right [sourceF field])
@@ -240,50 +240,50 @@
(recur sourceFV (#.Cons [field value] stack)))
(#.Left [source' error])
- (if (is? ..close-record error)
+ (if (is? ..close_record error)
(#.Right [source'
[where (#.Record (list.reverse stack))]])
(#.Left [source' error])))))
-(template: (!guarantee-no-new-lines where offset source-code content body)
- (case ("lux text index" 0 (static text.new-line) content)
+(template: (!guarantee_no_new_lines where offset source_code content body)
+ (case ("lux text index" 0 (static text.new_line) content)
#.None
body
g!_
- (#.Left [[where offset source-code]
- (exception.construct ..text-cannot-contain-new-lines content)])))
+ (#.Left [[where offset source_code]
+ (exception.construct ..text_cannot_contain_new_lines content)])))
-(def: (parse-text where offset source-code)
+(def: (parse_text where offset source_code)
(-> Location Nat Text (Either [Source Text] [Source Code]))
- (case ("lux text index" offset (static ..text-delimiter) source-code)
+ (case ("lux text index" offset (static ..text_delimiter) source_code)
(#.Some g!end)
- (<| (let [g!content (!clip offset g!end source-code)])
- (!guarantee-no-new-lines where offset source-code g!content)
+ (<| (let [g!content (!clip offset g!end source_code)])
+ (!guarantee_no_new_lines where offset source_code g!content)
(#.Right [[(let [size (!n/- offset g!end)]
(update@ #.column (|>> (!n/+ size) (!n/+ 2)) where))
(!inc g!end)
- source-code]
+ source_code]
[where
(#.Text g!content)]]))
_
- (!failure ..parse-text where offset source-code)))
+ (!failure ..parse_text where offset source_code)))
-(with-expansions [<digits> (as-is "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
- <non-name-chars> (template [<char>]
+(with_expansions [<digits> (as_is "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
+ <non_name_chars> (template [<char>]
[(~~ (static <char>))]
[text.space]
- [text.new-line] [text.carriage-return]
- [..name-separator]
- [..open-form] [..close-form]
- [..open-tuple] [..close-tuple]
- [..open-record] [..close-record]
- [..text-delimiter]
+ [text.new_line] [text.carriage_return]
+ [..name_separator]
+ [..open_form] [..close_form]
+ [..open_tuple] [..close_tuple]
+ [..open_record] [..close_record]
+ [..text_delimiter]
[..sigil])
- <digit-separator> (static ..digit-separator)]
- (template: (!if-digit? @char @then @else)
+ <digit_separator> (static ..digit_separator)]
+ (template: (!if_digit? @char @then @else)
("lux syntax char case!" @char
[[<digits>]
@then]
@@ -291,279 +291,279 @@
## else
@else))
- (template: (!if-digit?+ @char @then @else-options @else)
+ (template: (!if_digit?+ @char @then @else_options @else)
(`` ("lux syntax char case!" @char
- [[<digits> <digit-separator>]
+ [[<digits> <digit_separator>]
@then
- (~~ (template.splice @else-options))]
+ (~~ (template.splice @else_options))]
## else
@else)))
- (`` (template: (!if-name-char?|tail @char @then @else)
+ (`` (template: (!if_name_char?|tail @char @then @else)
("lux syntax char case!" @char
- [[<non-name-chars>]
+ [[<non_name_chars>]
@else]
## else
@then)))
- (`` (template: (!if-name-char?|head @char @then @else)
+ (`` (template: (!if_name_char?|head @char @then @else)
("lux syntax char case!" @char
- [[<non-name-chars> <digits>]
+ [[<non_name_chars> <digits>]
@else]
## else
@then)))
)
-(template: (!number-output <source-code> <start> <end> <codec> <tag>)
- (case (|> <source-code>
+(template: (!number_output <source_code> <start> <end> <codec> <tag>)
+ (case (|> <source_code>
(!clip <start> <end>)
- (text.replace-all ..digit-separator "")
+ (text.replace_all ..digit_separator "")
(\ <codec> decode))
(#.Right output)
(#.Right [[(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
<end>
- <source-code>]
+ <source_code>]
[where (<tag> output)]])
(#.Left error)
- (#.Left [[where <start> <source-code>]
+ (#.Left [[where <start> <source_code>]
error])))
-(def: no-exponent Offset 0)
+(def: no_exponent Offset 0)
-(with-expansions [<int-output> (as-is (!number-output source-code start end int.decimal #.Int))
- <frac-output> (as-is (!number-output source-code start end frac.decimal #.Frac))
- <failure> (!failure ..parse-frac where offset source-code)
- <frac-separator> (static ..frac-separator)
+(with_expansions [<int_output> (as_is (!number_output source_code start end int.decimal #.Int))
+ <frac_output> (as_is (!number_output source_code start end frac.decimal #.Frac))
+ <failure> (!failure ..parse_frac where offset source_code)
+ <frac_separator> (static ..frac_separator)
<signs> (template [<sign>]
[(~~ (static <sign>))]
- [..positive-sign]
- [..negative-sign])]
- (template: (parse-frac source-code//size start where offset source-code)
+ [..positive_sign]
+ [..negative_sign])]
+ (template: (parse_frac source_code//size start where offset source_code)
## (-> Nat Offset (Parser Code))
(loop [end offset
- exponent (static ..no-exponent)]
- (<| (!with-char+ source-code//size source-code end char/0 <frac-output>)
- (!if-digit?+ char/0
+ exponent (static ..no_exponent)]
+ (<| (!with_char+ source_code//size source_code end char/0 <frac_output>)
+ (!if_digit?+ char/0
(recur (!inc end) exponent)
[["e" "E"]
- (if (is? (static ..no-exponent) exponent)
- (<| (!with-char+ source-code//size source-code (!inc end) char/1 <failure>)
+ (if (is? (static ..no_exponent) exponent)
+ (<| (!with_char+ source_code//size source_code (!inc end) char/1 <failure>)
(`` ("lux syntax char case!" char/1
[[<signs>]
- (<| (!with-char+ source-code//size source-code (!n/+ 2 end) char/2 <failure>)
- (!if-digit?+ char/2
+ (<| (!with_char+ source_code//size source_code (!n/+ 2 end) char/2 <failure>)
+ (!if_digit?+ char/2
(recur (!n/+ 3 end) char/0)
[]
<failure>))]
## else
<failure>)))
- <frac-output>)]
+ <frac_output>)]
- <frac-output>))))
+ <frac_output>))))
- (template: (parse-signed source-code//size start where offset source-code)
+ (template: (parse_signed source_code//size start where offset source_code)
## (-> Nat Offset (Parser Code))
(loop [end offset]
- (<| (!with-char+ source-code//size source-code end char <int-output>)
- (!if-digit?+ char
+ (<| (!with_char+ source_code//size source_code end char <int_output>)
+ (!if_digit?+ char
(recur (!inc end))
- [[<frac-separator>]
- (parse-frac source-code//size start where (!inc end) source-code)]
+ [[<frac_separator>]
+ (parse_frac source_code//size start where (!inc end) source_code)]
- <int-output>))))
+ <int_output>))))
)
(template [<parser> <codec> <tag>]
- [(template: (<parser> source-code//size start where offset source-code)
+ [(template: (<parser> source_code//size start where offset source_code)
## (-> Nat Nat Location Nat Text (Either [Source Text] [Source Code]))
(loop [g!end offset]
- (<| (!with-char+ source-code//size source-code g!end g!char (!number-output source-code start g!end <codec> <tag>))
- (!if-digit?+ g!char
+ (<| (!with_char+ source_code//size source_code g!end g!char (!number_output source_code start g!end <codec> <tag>))
+ (!if_digit?+ g!char
(recur (!inc g!end))
[]
- (!number-output source-code start g!end <codec> <tag>)))))]
+ (!number_output source_code start g!end <codec> <tag>)))))]
- [parse-nat n.decimal #.Nat]
- [parse-rev rev.decimal #.Rev]
+ [parse_nat n.decimal #.Nat]
+ [parse_rev rev.decimal #.Rev]
)
-(template: (!parse-signed source-code//size offset where source-code @aliases @end)
+(template: (!parse_signed source_code//size offset where source_code @aliases @end)
(<| (let [g!offset/1 (!inc offset)])
- (!with-char+ source-code//size source-code g!offset/1 g!char/1 @end)
- (!if-digit? g!char/1
- (parse-signed source-code//size offset where (!inc/2 offset) source-code)
- (!parse-full-name offset [where (!inc offset) source-code] where @aliases #.Identifier))))
+ (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end)
+ (!if_digit? g!char/1
+ (parse_signed source_code//size offset where (!inc/2 offset) source_code)
+ (!parse_full_name offset [where (!inc offset) source_code] where @aliases #.Identifier))))
-(with-expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where)
+(with_expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where)
end
- source-code]
- (!clip start end source-code)])]
- (template: (parse-name-part start where offset source-code)
+ source_code]
+ (!clip start end source_code)])]
+ (template: (parse_name_part start where offset source_code)
## (-> Offset (Parser Text))
- (let [source-code//size ("lux text size" source-code)]
+ (let [source_code//size ("lux text size" source_code)]
(loop [end offset]
- (<| (!with-char+ source-code//size source-code end char <output>)
- (!if-name-char?|tail char
+ (<| (!with_char+ source_code//size source_code end char <output>)
+ (!if_name_char?|tail char
(recur (!inc end))
<output>))))))
-(template: (!parse-half-name @offset @char @module)
- (!if-name-char?|head @char
- (!letE [source' name] (..parse-name-part @offset where (!inc @offset) source-code)
+(template: (!parse_half_name @offset @char @module)
+ (!if_name_char?|head @char
+ (!letE [source' name] (..parse_name_part @offset where (!inc @offset) source_code)
(#.Right [source' [@module name]]))
- (!failure ..!parse-half-name where @offset source-code)))
+ (!failure ..!parse_half_name where @offset source_code)))
-(`` (def: (parse-short-name source-code//size current-module [where offset/0 source-code])
+(`` (def: (parse_short_name source_code//size current_module [where offset/0 source_code])
(-> Nat Text (Parser Name))
- (<| (!with-char+ source-code//size source-code offset/0 char/0
- (!end-of-file where offset/0 source-code current-module))
- (if (!n/= (char (~~ (static ..name-separator))) char/0)
+ (<| (!with_char+ source_code//size source_code offset/0 char/0
+ (!end_of_file where offset/0 source_code current_module))
+ (if (!n/= (char (~~ (static ..name_separator))) char/0)
(<| (let [offset/1 (!inc offset/0)])
- (!with-char+ source-code//size source-code offset/1 char/1
- (!end-of-file where offset/1 source-code current-module))
- (!parse-half-name offset/1 char/1 current-module))
- (!parse-half-name offset/0 char/0 (static ..prelude))))))
+ (!with_char+ source_code//size source_code offset/1 char/1
+ (!end_of_file where offset/1 source_code current_module))
+ (!parse_half_name offset/1 char/1 current_module))
+ (!parse_half_name offset/0 char/0 (static ..prelude))))))
-(template: (!parse-short-name source-code//size @current-module @source @where @tag)
- (!letE [source' name] (..parse-short-name source-code//size @current-module @source)
+(template: (!parse_short_name source_code//size @current_module @source @where @tag)
+ (!letE [source' name] (..parse_short_name source_code//size @current_module @source)
(#.Right [source' [@where (@tag name)]])))
-(with-expansions [<simple> (as-is (#.Right [source' ["" simple]]))]
- (`` (def: (parse-full-name aliases start source)
+(with_expansions [<simple> (as_is (#.Right [source' ["" simple]]))]
+ (`` (def: (parse_full_name aliases start source)
(-> Aliases Offset (Parser Name))
- (<| (!letE [source' simple] (let [[where offset source-code] source]
- (..parse-name-part start where offset source-code)))
- (let [[where' offset' source-code'] source'])
- (!with-char source-code' offset' char/separator <simple>)
- (if (!n/= (char (~~ (static ..name-separator))) char/separator)
+ (<| (!letE [source' simple] (let [[where offset source_code] source]
+ (..parse_name_part start where offset source_code)))
+ (let [[where' offset' source_code'] source'])
+ (!with_char source_code' offset' char/separator <simple>)
+ (if (!n/= (char (~~ (static ..name_separator))) char/separator)
(<| (let [offset'' (!inc offset')])
- (!letE [source'' complex] (..parse-name-part offset'' (!forward 1 where') offset'' source-code'))
+ (!letE [source'' complex] (..parse_name_part offset'' (!forward 1 where') offset'' source_code'))
(if ("lux text =" "" complex)
- (let [[where offset source-code] source]
- (!failure ..parse-full-name where offset source-code))
+ (let [[where offset source_code] source]
+ (!failure ..parse_full_name where offset source_code))
(#.Right [source'' [(|> aliases
(dictionary.get simple)
(maybe.default simple))
complex]])))
<simple>)))))
-(template: (!parse-full-name @offset @source @where @aliases @tag)
- (!letE [source' full-name] (..parse-full-name @aliases @offset @source)
- (#.Right [source' [@where (@tag full-name)]])))
+(template: (!parse_full_name @offset @source @where @aliases @tag)
+ (!letE [source' full_name] (..parse_full_name @aliases @offset @source)
+ (#.Right [source' [@where (@tag full_name)]])))
## TODO: Grammar macro for specifying syntax.
-## (grammar: lux-grammar
+## (grammar: lux_grammar
## [expression ...]
## [form "(" [#* expression] ")"])
-(with-expansions [<consume-1> (as-is where (!inc offset/0) source-code)
- <move-1> (as-is [(!forward 1 where) (!inc offset/0) source-code])
- <move-2> (as-is [(!forward 1 where) (!inc/2 offset/0) source-code])
- <recur> (as-is (parse current-module aliases source-code//size))
- <horizontal-move> (as-is (recur (!horizontal where offset/0 source-code)))]
+(with_expansions [<consume_1> (as_is where (!inc offset/0) source_code)
+ <move_1> (as_is [(!forward 1 where) (!inc offset/0) source_code])
+ <move_2> (as_is [(!forward 1 where) (!inc/2 offset/0) source_code])
+ <recur> (as_is (parse current_module aliases source_code//size))
+ <horizontal_move> (as_is (recur (!horizontal where offset/0 source_code)))]
(template: (!close closer)
- (#.Left [<move-1> closer]))
+ (#.Left [<move_1> closer]))
- (def: #export (parse current-module aliases source-code//size)
+ (def: #export (parse current_module aliases source_code//size)
(-> Text Aliases Nat (Parser Code))
## The "exec []" is only there to avoid function fusion.
## This is to preserve the loop as much as possible and keep it tight.
(exec []
- (function (recur [where offset/0 source-code])
- (<| (!with-char+ source-code//size source-code offset/0 char/0
- (!end-of-file where offset/0 source-code current-module))
- (with-expansions [<composites> (template [<open> <close> <parser>]
+ (function (recur [where offset/0 source_code])
+ (<| (!with_char+ source_code//size source_code offset/0 char/0
+ (!end_of_file where offset/0 source_code current_module))
+ (with_expansions [<composites> (template [<open> <close> <parser>]
[[(~~ (static <open>))]
- (<parser> <recur> <consume-1>)
+ (<parser> <recur> <consume_1>)
[(~~ (static <close>))]
(!close <close>)]
- [..open-form ..close-form parse-form]
- [..open-tuple ..close-tuple parse-tuple]
- [..open-record ..close-record parse-record]
+ [..open_form ..close_form parse_form]
+ [..open_tuple ..close_tuple parse_tuple]
+ [..open_record ..close_record parse_record]
)]
(`` ("lux syntax char case!" char/0
[[(~~ (static text.space))
- (~~ (static text.carriage-return))]
- <horizontal-move>
+ (~~ (static text.carriage_return))]
+ <horizontal_move>
## New line
- [(~~ (static text.new-line))]
- (recur (!vertical where offset/0 source-code))
+ [(~~ (static text.new_line))]
+ (recur (!vertical where offset/0 source_code))
<composites>
## Text
- [(~~ (static ..text-delimiter))]
- (parse-text where (!inc offset/0) source-code)
+ [(~~ (static ..text_delimiter))]
+ (parse_text where (!inc offset/0) source_code)
## Special code
[(~~ (static ..sigil))]
(<| (let [offset/1 (!inc offset/0)])
- (!with-char+ source-code//size source-code offset/1 char/1
- (!end-of-file where offset/1 source-code current-module))
+ (!with_char+ source_code//size source_code offset/1 char/1
+ (!end_of_file where offset/1 source_code current_module))
("lux syntax char case!" char/1
- [[(~~ (static ..name-separator))]
- (!parse-short-name source-code//size current-module <move-2> where #.Tag)
+ [[(~~ (static ..name_separator))]
+ (!parse_short_name source_code//size current_module <move_2> where #.Tag)
- ## Single-line comment
+ ## Single_line comment
[(~~ (static ..sigil))]
- (case ("lux text index" (!inc offset/1) (static text.new-line) source-code)
+ (case ("lux text index" (!inc offset/1) (static text.new_line) source_code)
(#.Some end)
- (recur (!vertical where end source-code))
+ (recur (!vertical where end source_code))
_
- (!end-of-file where offset/1 source-code current-module))
+ (!end_of_file where offset/1 source_code current_module))
(~~ (template [<char> <bit>]
[[<char>]
(#.Right [[(update@ #.column (|>> !inc/2) where)
(!inc offset/1)
- source-code]
+ source_code]
[where (#.Bit <bit>)]])]
["0" #0]
["1" #1]))]
## else
- (!if-name-char?|head char/1
+ (!if_name_char?|head char/1
## Tag
- (!parse-full-name offset/1 <move-2> where aliases #.Tag)
- (!failure ..parse where offset/0 source-code))))
+ (!parse_full_name offset/1 <move_2> where aliases #.Tag)
+ (!failure ..parse where offset/0 source_code))))
- ## Coincidentally (= ..name-separator ..frac-separator)
- [(~~ (static ..name-separator))
- ## (~~ (static ..frac-separator))
+ ## Coincidentally (= ..name_separator ..frac_separator)
+ [(~~ (static ..name_separator))
+ ## (~~ (static ..frac_separator))
]
(<| (let [offset/1 (!inc offset/0)])
- (!with-char+ source-code//size source-code offset/1 char/1
- (!end-of-file where offset/1 source-code current-module))
- (!if-digit? char/1
- (parse-rev source-code//size offset/0 where (!inc offset/1) source-code)
- (!parse-short-name source-code//size current-module [where offset/1 source-code] where #.Identifier)))
+ (!with_char+ source_code//size source_code offset/1 char/1
+ (!end_of_file where offset/1 source_code current_module))
+ (!if_digit? char/1
+ (parse_rev source_code//size offset/0 where (!inc offset/1) source_code)
+ (!parse_short_name source_code//size current_module [where offset/1 source_code] where #.Identifier)))
- [(~~ (static ..positive-sign))
- (~~ (static ..negative-sign))]
- (!parse-signed source-code//size offset/0 where source-code aliases
- (!end-of-file where offset/0 source-code current-module))]
+ [(~~ (static ..positive_sign))
+ (~~ (static ..negative_sign))]
+ (!parse_signed source_code//size offset/0 where source_code aliases
+ (!end_of_file where offset/0 source_code current_module))]
## else
- (!if-digit? char/0
+ (!if_digit? char/0
## Natural number
- (parse-nat source-code//size offset/0 where (!inc offset/0) source-code)
+ (parse_nat source_code//size offset/0 where (!inc offset/0) source_code)
## Identifier
- (!parse-full-name offset/0 [<consume-1>] where aliases #.Identifier))
+ (!parse_full_name offset/0 [<consume_1>] where aliases #.Identifier))
)))
)))
))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux
index 36dd33b23..a421d1ba9 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux
@@ -40,7 +40,7 @@
## https://en.wikipedia.org/wiki/Currying
#currying? Bit})
-(def: #export fresh-resolver
+(def: #export fresh_resolver
Resolver
(dictionary.new variable.hash))
@@ -72,10 +72,10 @@
#Pop
(#Access Access)
(#Bind Register)
- (#Bit-Fork Bit (Path' s) (Maybe (Path' s)))
- (#I64-Fork (Fork (I64 Any) (Path' s)))
- (#F64-Fork (Fork Frac (Path' s)))
- (#Text-Fork (Fork Text (Path' s)))
+ (#Bit_Fork Bit (Path' s) (Maybe (Path' s)))
+ (#I64_Fork (Fork (I64 Any) (Path' s)))
+ (#F64_Fork (Fork Frac (Path' s)))
+ (#Text_Fork (Fork Text (Path' s)))
(#Alt (Path' s) (Path' s))
(#Seq (Path' s) (Path' s))
(#Then s))
@@ -194,15 +194,15 @@
(Operation <type>)
(extension.read (get@ <tag>)))]
- [with-locals locals #locals Nat]
- [with-currying? currying? #currying? Bit]
+ [with_locals locals #locals Nat]
+ [with_currying? currying? #currying? Bit]
)
-(def: #export with-new-local
+(def: #export with_new_local
(All [a] (-> (Operation a) (Operation a)))
(<<| (do phase.monad
[locals ..locals])
- (..with-locals (inc locals))))
+ (..with_locals (inc locals))))
(template [<name> <tag>]
[(template: #export (<name> content)
@@ -261,7 +261,7 @@
#Pop
"_"
- (#Bit-Fork when then else)
+ (#Bit_Fork when then else)
(format "(?"
" " (%.bit when) " " (%path' %then then)
(case else
@@ -277,11 +277,11 @@
(|> (#.Cons cons)
(list\map (function (_ [test then])
(format (<format> test) " " (%path' %then then))))
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["(? " ")"]))])
- ([#I64-Fork (|>> .int %.int)]
- [#F64-Fork %.frac]
- [#Text-Fork %.text])
+ ([#I64_Fork (|>> .int %.int)]
+ [#F64_Fork %.frac]
+ [#Text_Fork %.text])
(#Access access)
(case access
@@ -339,7 +339,7 @@
(#analysis.Tuple members)
(|> members
(list\map %synthesis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"])))
(#Reference reference)
@@ -352,7 +352,7 @@
(#Abstraction [environment arity body])
(let [environment' (|> environment
(list\map %synthesis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"]))]
(|> (format environment' " " (%.nat arity) " " (%synthesis body))
(text.enclose ["(#function " ")"])))
@@ -360,7 +360,7 @@
(#Apply func args)
(|> args
(list\map %synthesis)
- (text.join-with " ")
+ (text.join_with " ")
(format (%synthesis func) " ")
(text.enclose ["(" ")"])))
@@ -390,7 +390,7 @@
(|> (format (%.nat (get@ #start scope))
" " (|> (get@ #inits scope)
(list\map %synthesis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"]))
" " (%synthesis (get@ #iteration scope)))
(text.enclose ["(#loop " ")"]))
@@ -398,12 +398,12 @@
(#Recur args)
(|> args
(list\map %synthesis)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["(#recur " ")"]))))
(#Extension [name args])
(|> (list\map %synthesis args)
- (text.join-with " ")
+ (text.join_with " ")
(format (%.text name) " ")
(text.enclose ["(" ")"]))))
@@ -411,7 +411,7 @@
(Format Path)
(%path' %synthesis))
-(structure: #export primitive-equivalence
+(structure: #export primitive_equivalence
(Equivalence Primitive)
(def: (= reference sample)
@@ -429,10 +429,10 @@
_
false)))
-(structure: primitive-hash
+(structure: primitive_hash
(Hash Primitive)
- (def: &equivalence ..primitive-equivalence)
+ (def: &equivalence ..primitive_equivalence)
(def: hash
(|>> (case> (^template [<tag> <hash>]
@@ -443,19 +443,19 @@
[#Text text.hash]
[#I64 i64.hash])))))
-(def: side-equivalence
+(def: side_equivalence
(Equivalence Side)
(sum.equivalence n.equivalence n.equivalence))
-(def: member-equivalence
+(def: member_equivalence
(Equivalence Member)
(sum.equivalence n.equivalence n.equivalence))
-(def: member-hash
+(def: member_hash
(Hash Member)
(sum.hash n.hash n.hash))
-(structure: #export access-equivalence
+(structure: #export access_equivalence
(Equivalence Access)
(def: (= reference sample)
@@ -463,27 +463,27 @@
(^template [<tag> <equivalence>]
[[(<tag> reference) (<tag> sample)]
(\ <equivalence> = reference sample)])
- ([#Side ..side-equivalence]
- [#Member ..member-equivalence])
+ ([#Side ..side_equivalence]
+ [#Member ..member_equivalence])
_
false)))
-(structure: access-hash
+(structure: access_hash
(Hash Access)
- (def: &equivalence ..access-equivalence)
+ (def: &equivalence ..access_equivalence)
(def: (hash value)
- (let [sub-hash (sum.hash n.hash n.hash)]
+ (let [sub_hash (sum.hash n.hash n.hash)]
(case value
(^template [<tag>]
[(<tag> value)
- (\ sub-hash hash value)])
+ (\ sub_hash hash value)])
([#Side]
[#Member])))))
-(structure: #export (path'-equivalence equivalence)
+(structure: #export (path'_equivalence equivalence)
(All [a] (-> (Equivalence a) (Equivalence (Path' a))))
(def: (= reference sample)
@@ -491,26 +491,26 @@
[#Pop #Pop]
true
- [(#Bit-Fork reference-when reference-then reference-else)
- (#Bit-Fork sample-when sample-then sample-else)]
- (and (bit\= reference-when sample-when)
- (= reference-then sample-then)
- (\ (maybe.equivalence =) = reference-else sample-else))
+ [(#Bit_Fork reference_when reference_then reference_else)
+ (#Bit_Fork sample_when sample_then sample_else)]
+ (and (bit\= reference_when sample_when)
+ (= reference_then sample_then)
+ (\ (maybe.equivalence =) = reference_else sample_else))
(^template [<tag> <equivalence>]
- [[(<tag> reference-cons)
- (<tag> sample-cons)]
+ [[(<tag> reference_cons)
+ (<tag> sample_cons)]
(\ (list.equivalence (product.equivalence <equivalence> =)) =
- (#.Cons reference-cons)
- (#.Cons sample-cons))])
- ([#I64-Fork i64.equivalence]
- [#F64-Fork f.equivalence]
- [#Text-Fork text.equivalence])
+ (#.Cons reference_cons)
+ (#.Cons sample_cons))])
+ ([#I64_Fork i64.equivalence]
+ [#F64_Fork f.equivalence]
+ [#Text_Fork text.equivalence])
(^template [<tag> <equivalence>]
[[(<tag> reference') (<tag> sample')]
(\ <equivalence> = reference' sample')])
- ([#Access ..access-equivalence]
+ ([#Access ..access_equivalence]
[#Then equivalence])
[(#Bind reference') (#Bind sample')]
@@ -526,11 +526,11 @@
_
false)))
-(structure: (path'-hash super)
+(structure: (path'_hash super)
(All [a] (-> (Hash a) (Hash (Path' a))))
(def: &equivalence
- (..path'-equivalence (\ super &equivalence)))
+ (..path'_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
@@ -538,32 +538,32 @@
2
(#Access access)
- (n.* 3 (\ ..access-hash hash access))
+ (n.* 3 (\ ..access_hash hash access))
(#Bind register)
(n.* 5 (\ n.hash hash register))
- (#Bit-Fork when then else)
+ (#Bit_Fork when then else)
($_ n.* 7
(\ bit.hash hash when)
(hash then)
- (\ (maybe.hash (path'-hash super)) hash else))
+ (\ (maybe.hash (path'_hash super)) hash else))
(^template [<factor> <tag> <hash>]
[(<tag> cons)
- (let [case-hash (product.hash <hash>
- (path'-hash super))
- cons-hash (product.hash case-hash (list.hash case-hash))]
- (n.* <factor> (\ cons-hash hash cons)))])
- ([11 #I64-Fork i64.hash]
- [13 #F64-Fork f.hash]
- [17 #Text-Fork text.hash])
+ (let [case_hash (product.hash <hash>
+ (path'_hash super))
+ cons_hash (product.hash case_hash (list.hash case_hash))]
+ (n.* <factor> (\ cons_hash hash cons)))])
+ ([11 #I64_Fork i64.hash]
+ [13 #F64_Fork f.hash]
+ [17 #Text_Fork text.hash])
(^template [<factor> <tag>]
[(<tag> fork)
- (let [recur-hash (path'-hash super)
- fork-hash (product.hash recur-hash recur-hash)]
- (n.* <factor> (\ fork-hash hash fork)))])
+ (let [recur_hash (path'_hash super)
+ fork_hash (product.hash recur_hash recur_hash)]
+ (n.* <factor> (\ fork_hash hash fork)))])
([19 #Alt]
[23 #Seq])
@@ -571,41 +571,41 @@
(n.* 29 (\ super hash body))
)))
-(structure: (branch-equivalence (^open "\."))
+(structure: (branch_equivalence (^open "\."))
(All [a] (-> (Equivalence a) (Equivalence (Branch a))))
(def: (= reference sample)
(case [reference sample]
- [(#Let [reference-input reference-register reference-body])
- (#Let [sample-input sample-register sample-body])]
- (and (\= reference-input sample-input)
- (n.= reference-register sample-register)
- (\= reference-body sample-body))
-
- [(#If [reference-test reference-then reference-else])
- (#If [sample-test sample-then sample-else])]
- (and (\= reference-test sample-test)
- (\= reference-then sample-then)
- (\= reference-else sample-else))
+ [(#Let [reference_input reference_register reference_body])
+ (#Let [sample_input sample_register sample_body])]
+ (and (\= reference_input sample_input)
+ (n.= reference_register sample_register)
+ (\= reference_body sample_body))
+
+ [(#If [reference_test reference_then reference_else])
+ (#If [sample_test sample_then sample_else])]
+ (and (\= reference_test sample_test)
+ (\= reference_then sample_then)
+ (\= reference_else sample_else))
- [(#Get [reference-path reference-record])
- (#Get [sample-path sample-record])]
- (and (\ (list.equivalence ..member-equivalence) = reference-path sample-path)
- (\= reference-record sample-record))
+ [(#Get [reference_path reference_record])
+ (#Get [sample_path sample_record])]
+ (and (\ (list.equivalence ..member_equivalence) = reference_path sample_path)
+ (\= reference_record sample_record))
- [(#Case [reference-input reference-path])
- (#Case [sample-input sample-path])]
- (and (\= reference-input sample-input)
- (\ (path'-equivalence \=) = reference-path sample-path))
+ [(#Case [reference_input reference_path])
+ (#Case [sample_input sample_path])]
+ (and (\= reference_input sample_input)
+ (\ (path'_equivalence \=) = reference_path sample_path))
_
false)))
-(structure: (branch-hash super)
+(structure: (branch_hash super)
(All [a] (-> (Hash a) (Hash (Branch a))))
(def: &equivalence
- (..branch-equivalence (\ super &equivalence)))
+ (..branch_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
@@ -623,25 +623,25 @@
(#Get [path record])
($_ n.* 5
- (\ (list.hash ..member-hash) hash path)
+ (\ (list.hash ..member_hash) hash path)
(\ super hash record))
(#Case [input path])
($_ n.* 7
(\ super hash input)
- (\ (..path'-hash super) hash path))
+ (\ (..path'_hash super) hash path))
)))
-(structure: (loop-equivalence (^open "\."))
+(structure: (loop_equivalence (^open "\."))
(All [a] (-> (Equivalence a) (Equivalence (Loop a))))
(def: (= reference sample)
(case [reference sample]
- [(#Scope [reference-start reference-inits reference-iteration])
- (#Scope [sample-start sample-inits sample-iteration])]
- (and (n.= reference-start sample-start)
- (\ (list.equivalence \=) = reference-inits sample-inits)
- (\= reference-iteration sample-iteration))
+ [(#Scope [reference_start reference_inits reference_iteration])
+ (#Scope [sample_start sample_inits sample_iteration])]
+ (and (n.= reference_start sample_start)
+ (\ (list.equivalence \=) = reference_inits sample_inits)
+ (\= reference_iteration sample_iteration))
[(#Recur reference) (#Recur sample)]
(\ (list.equivalence \=) = reference sample)
@@ -649,11 +649,11 @@
_
false)))
-(structure: (loop-hash super)
+(structure: (loop_hash super)
(All [a] (-> (Hash a) (Hash (Loop a))))
(def: &equivalence
- (..loop-equivalence (\ super &equivalence)))
+ (..loop_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
@@ -668,30 +668,30 @@
(\ (list.hash super) hash resets))
)))
-(structure: (function-equivalence (^open "\."))
+(structure: (function_equivalence (^open "\."))
(All [a] (-> (Equivalence a) (Equivalence (Function a))))
(def: (= reference sample)
(case [reference sample]
- [(#Abstraction [reference-environment reference-arity reference-body])
- (#Abstraction [sample-environment sample-arity sample-body])]
- (and (\ (list.equivalence \=) = reference-environment sample-environment)
- (n.= reference-arity sample-arity)
- (\= reference-body sample-body))
+ [(#Abstraction [reference_environment reference_arity reference_body])
+ (#Abstraction [sample_environment sample_arity sample_body])]
+ (and (\ (list.equivalence \=) = reference_environment sample_environment)
+ (n.= reference_arity sample_arity)
+ (\= reference_body sample_body))
- [(#Apply [reference-abstraction reference-arguments])
- (#Apply [sample-abstraction sample-arguments])]
- (and (\= reference-abstraction sample-abstraction)
- (\ (list.equivalence \=) = reference-arguments sample-arguments))
+ [(#Apply [reference_abstraction reference_arguments])
+ (#Apply [sample_abstraction sample_arguments])]
+ (and (\= reference_abstraction sample_abstraction)
+ (\ (list.equivalence \=) = reference_arguments sample_arguments))
_
false)))
-(structure: (function-hash super)
+(structure: (function_hash super)
(All [a] (-> (Hash a) (Hash (Function a))))
(def: &equivalence
- (..function-equivalence (\ super &equivalence)))
+ (..function_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
@@ -707,7 +707,7 @@
(\ (list.hash super) hash arguments))
)))
-(structure: (control-equivalence (^open "\."))
+(structure: (control_equivalence (^open "\."))
(All [a] (-> (Equivalence a) (Equivalence (Control a))))
(def: (= reference sample)
@@ -715,27 +715,27 @@
(^template [<tag> <equivalence>]
[[(<tag> reference) (<tag> sample)]
(\ (<equivalence> \=) = reference sample)])
- ([#Branch ..branch-equivalence]
- [#Loop ..loop-equivalence]
- [#Function ..function-equivalence])
+ ([#Branch ..branch_equivalence]
+ [#Loop ..loop_equivalence]
+ [#Function ..function_equivalence])
_
false)))
-(structure: (control-hash super)
+(structure: (control_hash super)
(All [a] (-> (Hash a) (Hash (Control a))))
(def: &equivalence
- (..control-equivalence (\ super &equivalence)))
+ (..control_equivalence (\ super &equivalence)))
(def: (hash value)
(case value
(^template [<factor> <tag> <hash>]
[(<tag> value)
(n.* <factor> (\ (<hash> super) hash value))])
- ([2 #Branch ..branch-hash]
- [3 #Loop ..loop-hash]
- [5 #Function ..function-hash])
+ ([2 #Branch ..branch_hash]
+ [3 #Loop ..loop_hash]
+ [5 #Function ..function_hash])
)))
(structure: #export equivalence
@@ -746,18 +746,18 @@
(^template [<tag> <equivalence>]
[[(<tag> reference') (<tag> sample')]
(\ <equivalence> = reference' sample')])
- ([#Primitive ..primitive-equivalence]
- [#Structure (analysis.composite-equivalence =)]
+ ([#Primitive ..primitive_equivalence]
+ [#Structure (analysis.composite_equivalence =)]
[#Reference reference.equivalence]
- [#Control (control-equivalence =)]
+ [#Control (control_equivalence =)]
[#Extension (extension.equivalence =)])
_
false)))
-(def: #export path-equivalence
+(def: #export path_equivalence
(Equivalence Path)
- (path'-equivalence equivalence))
+ (path'_equivalence equivalence))
(structure: #export hash
(Hash Synthesis)
@@ -765,24 +765,24 @@
(def: &equivalence ..equivalence)
(def: (hash value)
- (let [recur-hash [..equivalence hash]]
+ (let [recur_hash [..equivalence hash]]
(case value
(^template [<tag> <hash>]
[(<tag> value)
(\ <hash> hash value)])
- ([#Primitive ..primitive-hash]
- [#Structure (analysis.composite-hash recur-hash)]
+ ([#Primitive ..primitive_hash]
+ [#Structure (analysis.composite_hash recur_hash)]
[#Reference reference.hash]
- [#Control (..control-hash recur-hash)]
- [#Extension (extension.hash recur-hash)])))))
+ [#Control (..control_hash recur_hash)]
+ [#Extension (extension.hash recur_hash)])))))
-(template: #export (!bind-top register thenP)
+(template: #export (!bind_top register thenP)
($_ ..path/seq
(#..Bind register)
#..Pop
thenP))
-(template: #export (!multi-pop nextP)
+(template: #export (!multi_pop nextP)
($_ ..path/seq
#..Pop
#..Pop
@@ -802,6 +802,6 @@
#..Pop
nextP))]
- [simple-left-side ..side/left]
- [simple-right-side ..side/right]
+ [simple_left_side ..side/left]
+ [simple_right_side ..side/right]
)
diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux
index eaabf6aee..7abacd4fc 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive.lux
@@ -33,13 +33,13 @@
[///
[version (#+ Version)]]])
-(exception: #export (unknown-document {module Module}
- {known-modules (List Module)})
+(exception: #export (unknown_document {module Module}
+ {known_modules (List Module)})
(exception.report
["Module" (%.text module)]
- ["Known Modules" (exception.enumerate %.text known-modules)]))
+ ["Known Modules" (exception.enumerate %.text known_modules)]))
-(exception: #export (cannot-replace-document {module Module}
+(exception: #export (cannot_replace_document {module Module}
{old (Document Any)}
{new (Document Any)})
(exception.report
@@ -47,22 +47,22 @@
["Old key" (signature.description (document.signature old))]
["New key" (signature.description (document.signature new))]))
-(exception: #export (module-has-already-been-reserved {module Module})
+(exception: #export (module_has_already_been_reserved {module Module})
(exception.report
["Module" (%.text module)]))
-(exception: #export (module-must-be-reserved-before-it-can-be-added {module Module})
+(exception: #export (module_must_be_reserved_before_it_can_be_added {module Module})
(exception.report
["Module" (%.text module)]))
-(exception: #export (module-is-only-reserved {module Module})
+(exception: #export (module_is_only_reserved {module Module})
(exception.report
["Module" (%.text module)]))
(type: #export ID
Nat)
-(def: #export runtime-module
+(def: #export runtime_module
Module
"")
@@ -87,7 +87,7 @@
(#try.Success id)
#.None
- (exception.throw ..unknown-document [module
+ (exception.throw ..unknown_document [module
(dictionary.keys resolver)]))))
(def: #export (reserve module archive)
@@ -95,7 +95,7 @@
(let [(^slots [#..next #..resolver]) (:representation archive)]
(case (dictionary.get module resolver)
(#.Some _)
- (exception.throw ..module-has-already-been-reserved [module])
+ (exception.throw ..module_has_already_been_reserved [module])
#.None
(#try.Success [next
@@ -115,14 +115,14 @@
(update@ #..resolver (dictionary.put module [id (#.Some [descriptor document])]))
:abstraction))
- (#.Some [id (#.Some [existing-descriptor existing-document])])
- (if (is? document existing-document)
+ (#.Some [id (#.Some [existing_descriptor existing_document])])
+ (if (is? document existing_document)
## TODO: Find out why this code allows for the same module to be added more than once. It looks fishy...
(#try.Success archive)
- (exception.throw ..cannot-replace-document [module existing-document document]))
+ (exception.throw ..cannot_replace_document [module existing_document document]))
#.None
- (exception.throw ..module-must-be-reserved-before-it-can-be-added [module]))))
+ (exception.throw ..module_must_be_reserved_before_it_can_be_added [module]))))
(def: #export (find module archive)
(-> Module Archive (Try [Descriptor (Document Any)]))
@@ -132,10 +132,10 @@
(#try.Success document)
(#.Some [id #.None])
- (exception.throw ..module-is-only-reserved [module])
+ (exception.throw ..module_is_only_reserved [module])
#.None
- (exception.throw ..unknown-document [module
+ (exception.throw ..unknown_document [module
(dictionary.keys resolver)]))))
(def: #export (archived? archive module)
@@ -228,42 +228,42 @@
[version next]
(binary.run ..writer))))
- (exception: #export (version-mismatch {expected Version} {actual Version})
+ (exception: #export (version_mismatch {expected Version} {actual Version})
(exception.report
["Expected" (%.nat expected)]
["Actual" (%.nat actual)]))
- (exception: #export corrupt-data)
+ (exception: #export corrupt_data)
- (def: (correct-modules? reservations)
+ (def: (correct_modules? reservations)
(-> (List Reservation) Bit)
(n.= (list.size reservations)
(|> reservations
(list\map product.left)
- (set.from-list text.hash)
+ (set.from_list text.hash)
set.size)))
- (def: (correct-ids? reservations)
+ (def: (correct_ids? reservations)
(-> (List Reservation) Bit)
(n.= (list.size reservations)
(|> reservations
(list\map product.right)
- (set.from-list n.hash)
+ (set.from_list n.hash)
set.size)))
- (def: (correct-reservations? reservations)
+ (def: (correct_reservations? reservations)
(-> (List Reservation) Bit)
- (and (correct-modules? reservations)
- (correct-ids? reservations)))
+ (and (correct_modules? reservations)
+ (correct_ids? reservations)))
(def: #export (import expected binary)
(-> Version Binary (Try Archive))
(do try.monad
[[actual next reservations] (<b>.run ..reader binary)
- _ (exception.assert ..version-mismatch [expected actual]
+ _ (exception.assert ..version_mismatch [expected actual]
(n\= expected actual))
- _ (exception.assert ..corrupt-data []
- (correct-reservations? reservations))]
+ _ (exception.assert ..corrupt_data []
+ (correct_reservations? reservations))]
(wrap (:abstraction
{#next next
#resolver (list\fold (function (_ [module id] archive)
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
index 319b23169..5592df470 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux
@@ -79,7 +79,7 @@
(|> registry
:representation
(get@ #artifacts)
- row.to-list
+ row.to_list
(list.all (|>> (get@ #category)
(case> (<tag> name) (#.Some name)
_ #.None)))))]
@@ -117,7 +117,7 @@
(row\map (get@ #category))
artifacts)))
- (exception: #export (invalid-category {tag Nat})
+ (exception: #export (invalid_category {tag Nat})
(exception.report
["Tag" (%.nat tag)]))
@@ -133,7 +133,7 @@
3 (\ ! map (|>> #Synthesizer) <b>.text)
4 (\ ! map (|>> #Generator) <b>.text)
5 (\ ! map (|>> #Directive) <b>.text)
- _ (<>.fail (exception.construct ..invalid-category [tag])))))]
+ _ (<>.fail (exception.construct ..invalid_category [tag])))))]
(|> (<b>.row/64 category)
(\ <>.monad map (row\fold (function (_ artifact registry)
(product.right
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux b/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux
index 2ae89cf4e..a31f6e793 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux
@@ -21,7 +21,7 @@
{#name Module
#file Path
#hash Nat
- #state Module-State
+ #state Module_State
#references (Set Module)
#registry Registry})
diff --git a/stdlib/source/lux/tool/compiler/meta/io.lux b/stdlib/source/lux/tool/compiler/meta/io.lux
index 0a7927aa0..6bafa0a79 100644
--- a/stdlib/source/lux/tool/compiler/meta/io.lux
+++ b/stdlib/source/lux/tool/compiler/meta/io.lux
@@ -13,7 +13,7 @@
(def: #export (sanitize system)
(All [m] (-> (System m) Text Text))
- (text.replace-all "/" (\ system separator)))
+ (text.replace_all "/" (\ system separator)))
-(def: #export lux-context
+(def: #export lux_context
"lux")
diff --git a/stdlib/source/lux/tool/compiler/meta/io/context.lux b/stdlib/source/lux/tool/compiler/meta/io/context.lux
index f8b31df58..6c44c026a 100644
--- a/stdlib/source/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/lux/tool/compiler/meta/io/context.lux
@@ -34,14 +34,14 @@
(exception.report
["Module" (%.text module)]))]
- [cannot-find-module]
- [cannot-read-module]
+ [cannot_find_module]
+ [cannot_read_module]
)
(type: #export Extension
Text)
-(def: lux-extension
+(def: lux_extension
Extension
".lux")
@@ -51,12 +51,12 @@
(//.sanitize system)
(format context (\ system separator))))
-(def: (find-source-file system contexts module extension)
+(def: (find_source_file system contexts module extension)
(-> (file.System Promise) (List Context) Module Extension
(Promise (Try [Path (File Promise)])))
(case contexts
#.Nil
- (promise\wrap (exception.throw ..cannot-find-module [module]))
+ (promise\wrap (exception.throw ..cannot_find_module [module]))
(#.Cons context contexts')
(do promise.monad
@@ -67,19 +67,19 @@
(wrap (#try.Success [path file]))
(#try.Failure _)
- (find-source-file system contexts' module extension)))))
+ (find_source_file system contexts' module extension)))))
-(def: (full-host-extension partial-host-extension)
+(def: (full_host_extension partial_host_extension)
(-> Extension Extension)
- (format partial-host-extension ..lux-extension))
+ (format partial_host_extension ..lux_extension))
-(def: (find-local-source-file system import contexts partial-host-extension module)
+(def: (find_local_source_file system import contexts partial_host_extension module)
(-> (file.System Promise) Import (List Context) Extension Module
(Promise (Try [Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do {! promise.monad}
- [outcome (..find-source-file system contexts module (..full-host-extension partial-host-extension))]
+ [outcome (..find_source_file system contexts module (..full_host_extension partial_host_extension))]
(case outcome
(#try.Success [path file])
(do (try.with !)
@@ -88,45 +88,45 @@
(#try.Failure _)
(do (try.with !)
- [[path file] (..find-source-file system contexts module ..lux-extension)
+ [[path file] (..find_source_file system contexts module ..lux_extension)
data (!.use (\ file content) [])]
(wrap [path data])))))
-(def: (find-library-source-file import partial-host-extension module)
+(def: (find_library_source_file import partial_host_extension module)
(-> Import Extension Module (Try [Path Binary]))
- (let [path (format module (..full-host-extension partial-host-extension))]
+ (let [path (format module (..full_host_extension partial_host_extension))]
(case (dictionary.get path import)
(#.Some data)
(#try.Success [path data])
#.None
- (let [path (format module ..lux-extension)]
+ (let [path (format module ..lux_extension)]
(case (dictionary.get path import)
(#.Some data)
(#try.Success [path data])
#.None
- (exception.throw ..cannot-find-module [module]))))))
+ (exception.throw ..cannot_find_module [module]))))))
-(def: (find-any-source-file system import contexts partial-host-extension module)
+(def: (find_any_source_file system import contexts partial_host_extension module)
(-> (file.System Promise) Import (List Context) Extension Module
(Promise (Try [Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do {! promise.monad}
- [outcome (find-local-source-file system import contexts partial-host-extension module)]
+ [outcome (find_local_source_file system import contexts partial_host_extension module)]
(case outcome
(#try.Success [path data])
(wrap outcome)
(#try.Failure _)
- (wrap (..find-library-source-file import partial-host-extension module)))))
+ (wrap (..find_library_source_file import partial_host_extension module)))))
-(def: #export (read system import contexts partial-host-extension module)
+(def: #export (read system import contexts partial_host_extension module)
(-> (file.System Promise) Import (List Context) Extension Module
(Promise (Try Input)))
(do (try.with promise.monad)
- [[path binary] (..find-any-source-file system import contexts partial-host-extension module)]
+ [[path binary] (..find_any_source_file system import contexts partial_host_extension module)]
(case (\ encoding.utf8 decode binary)
(#try.Success code)
(wrap {#////.module module
@@ -135,27 +135,27 @@
#////.code code})
(#try.Failure _)
- (promise\wrap (exception.throw ..cannot-read-module [module])))))
+ (promise\wrap (exception.throw ..cannot_read_module [module])))))
(type: #export Enumeration
(Dictionary Path Binary))
-(exception: #export (cannot-clean-path {prefix Path} {path Path})
+(exception: #export (cannot_clean_path {prefix Path} {path Path})
(exception.report
["Prefix" (%.text prefix)]
["Path" (%.text path)]))
-(def: (clean-path system context path)
+(def: (clean_path system context path)
(All [!] (-> (file.System !) Context Path (Try Path)))
(let [prefix (format context (\ system separator))]
- (case (text.split-with prefix path)
+ (case (text.split_with prefix path)
#.None
- (exception.throw ..cannot-clean-path [prefix path])
+ (exception.throw ..cannot_clean_path [prefix path])
(#.Some [_ path])
(#try.Success path))))
-(def: (enumerate-context system context enumeration)
+(def: (enumerate_context system context enumeration)
(-> (file.System Promise) Context Enumeration (Promise (Try Enumeration)))
(do {! (try.with promise.monad)}
[directory (!.use (\ system directory) [context])]
@@ -165,12 +165,12 @@
[files (!.use (\ directory files) [])
enumeration (monad.fold ! (function (_ file enumeration)
(let [path (!.use (\ file path) [])]
- (if (text.ends-with? ..lux-extension path)
+ (if (text.ends_with? ..lux_extension path)
(do !
- [path (promise\wrap (..clean-path system context path))
- source-code (!.use (\ file content) [])]
+ [path (promise\wrap (..clean_path system context path))
+ source_code (!.use (\ file content) [])]
(promise\wrap
- (dictionary.try-put path source-code enumeration)))
+ (dictionary.try_put path source_code enumeration)))
(wrap enumeration))))
enumeration
files)
@@ -184,7 +184,7 @@
(-> (file.System Promise) (List Context) (Action Enumeration))
(monad.fold (: (Monad Action)
(try.with promise.monad))
- (enumerate-context system)
+ (enumerate_context system)
(: Enumeration
(dictionary.new text.hash))
contexts))
diff --git a/stdlib/source/lux/tool/compiler/phase.lux b/stdlib/source/lux/tool/compiler/phase.lux
index 847faaefa..20cba5fc1 100644
--- a/stdlib/source/lux/tool/compiler/phase.lux
+++ b/stdlib/source/lux/tool/compiler/phase.lux
@@ -44,13 +44,13 @@
operation
(\ try.monad map product.right)))
-(def: #export get-state
+(def: #export get_state
(All [s o]
(Operation s s))
(function (_ state)
(#try.Success [state state])))
-(def: #export (set-state state)
+(def: #export (set_state state)
(All [s o]
(-> s (Operation s Any)))
(function (_ _)