aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/parser
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/parser')
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux21
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux29
2 files changed, 32 insertions, 18 deletions
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
index 0df269e60..87ab8efb5 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
@@ -3,7 +3,7 @@
(.require
[library
- [lux (.except Analysis nat int rev local)
+ [lux (.except nat int rev local)
[abstract
[monad (.only do)]]
[control
@@ -31,10 +31,11 @@
[arity (.only Arity)]
[reference (.only)
[variable (.only)]]]]]]
- ["/" \\library (.only Environment Analysis)])
+ ["/" \\library (.only Environment)])
(def (remaining_inputs asts)
- (-> (List Analysis) Text)
+ (-> (List /.Term)
+ Text)
(format text.new_line "Remaining input: "
(|> asts
(list#each /.format)
@@ -42,7 +43,7 @@
(with_template [<name>]
[(exception.def .public (<name> input)
- (Exception (List Analysis))
+ (Exception (List /.Term))
(exception.report
(list ["Input" (exception.listing /.format input)])))]
@@ -51,10 +52,12 @@
)
(type .public Parser
- (//.Parser (List Analysis)))
+ (//.Parser (List /.Term)))
(def .public (result parser input)
- (All (_ a) (-> (Parser a) (List Analysis) (Try a)))
+ (All (_ of)
+ (-> (Parser of) (List /.Term)
+ (Try of)))
(when (parser input)
{try.#Success [{.#End} value]}
{try.#Success value}
@@ -66,7 +69,7 @@
{try.#Failure error}))
(def .public any
- (Parser Analysis)
+ (Parser /.Term)
(function (_ input)
(when input
{.#End}
@@ -128,7 +131,9 @@
)
(def .public (tuple parser)
- (All (_ a) (-> (Parser a) (Parser a)))
+ (All (_ of)
+ (-> (Parser of)
+ (Parser of)))
(function (_ input)
(when input
(list.partial (/.tuple @ head) tail)
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
index 817681e1a..a94bdef36 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
@@ -3,7 +3,7 @@
(.require
[library
- [lux (.except Synthesis function loop i64 local)
+ [lux (.except function loop i64 local)
[abstract
[monad (.only do)]]
[control
@@ -31,11 +31,11 @@
[lux
[analysis (.only Environment)]]]]]]]
[\\library
- ["[0]" / (.only Synthesis Abstraction)]])
+ ["[0]" / (.only Abstraction)]])
(with_template [<name>]
[(exception.def .public (<name> input)
- (Exception (List Synthesis))
+ (Exception (List /.Term))
(exception.report
(list ["Input" (exception.listing /.%synthesis input)])))]
@@ -53,10 +53,12 @@
(exception.def .public empty_input)
(type .public Parser
- (//.Parser (List Synthesis)))
+ (//.Parser (List /.Term)))
(def .public (result parser input)
- (All (_ a) (-> (Parser a) (List Synthesis) (Try a)))
+ (All (_ of)
+ (-> (Parser of) (List /.Term)
+ (Try of)))
(when (parser input)
{try.#Failure error}
{try.#Failure error}
@@ -68,7 +70,7 @@
(exception.except ..unconsumed_input unconsumed)))
(def .public any
- (Parser Synthesis)
+ (Parser /.Term)
(.function (_ input)
(when input
{.#End}
@@ -103,7 +105,8 @@
(exception.except ..cannot_parse input)))))
(`` (def .public (<assertion> expected)
- (-> <type> (Parser Any))
+ (-> <type>
+ (Parser Any))
(.function (_ input)
(when input
(list.partial (<tag> @ actual) input')
@@ -124,7 +127,9 @@
)
(def .public (tuple parser)
- (All (_ a) (-> (Parser a) (Parser a)))
+ (All (_ of)
+ (-> (Parser of)
+ (Parser of)))
(.function (_ input)
(when input
(list.partial (/.tuple @ head) tail)
@@ -136,7 +141,9 @@
(exception.except ..cannot_parse input))))
(def .public (function expected parser)
- (All (_ a) (-> Arity (Parser a) (Parser [(Environment Synthesis) a])))
+ (All (_ of)
+ (-> Arity (Parser of)
+ (Parser [(Environment /.Term) of])))
(.function (_ input)
(when input
(list.partial (/.function/abstraction @ [environment actual body]) tail)
@@ -150,7 +157,9 @@
(exception.except ..cannot_parse input))))
(def .public (loop init_parsers iteration_parser)
- (All (_ a b) (-> (Parser a) (Parser b) (Parser [Register a b])))
+ (All (_ init iteration)
+ (-> (Parser init) (Parser iteration)
+ (Parser [Register init iteration])))
(.function (_ input)
(when input
(list.partial (/.loop/scope @ [start inits iteration]) tail)