diff options
Diffstat (limited to 'stdlib/source/parser')
-rw-r--r-- | stdlib/source/parser/lux/data/binary.lux | 5 | ||||
-rw-r--r-- | stdlib/source/parser/lux/meta/type.lux (renamed from stdlib/source/parser/lux/type.lux) | 25 | ||||
-rw-r--r-- | stdlib/source/parser/lux/program.lux | 8 |
3 files changed, 20 insertions, 18 deletions
diff --git a/stdlib/source/parser/lux/data/binary.lux b/stdlib/source/parser/lux/data/binary.lux index 1e1ac7704..00c3d3656 100644 --- a/stdlib/source/parser/lux/data/binary.lux +++ b/stdlib/source/parser/lux/data/binary.lux @@ -2,7 +2,6 @@ [library [lux (.except and or nat int rev list symbol type) [ffi (.only)] - [type (.only sharing)] [abstract [hash (.only Hash)] [monad (.only do)]] @@ -29,7 +28,9 @@ [math [number ["n" nat] - ["[0]" frac]]]]]) + ["[0]" frac]]] + [meta + [type (.only sharing)]]]]) (.type .public Offset Nat) diff --git a/stdlib/source/parser/lux/type.lux b/stdlib/source/parser/lux/meta/type.lux index a107a1778..7c7090474 100644 --- a/stdlib/source/parser/lux/type.lux +++ b/stdlib/source/parser/lux/meta/type.lux @@ -19,9 +19,10 @@ ["[0]" code]] [math [number - ["n" nat (.use "[1]#[0]" decimal)]]] - ["[0]" type (.use "[1]#[0]" equivalence) - ["[0]" check]]]]) + ["n" nat (.use "[1]#[0]" decimal)]]]]] + [\\library + ["[0]" / (.use "[1]#[0]" equivalence) + ["[0]" check]]]) (def |recursion_dummy| (template (|recursion_dummy|) @@ -159,20 +160,20 @@ (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT ..any] - (let [members (<flattener> (type.anonymous headT))] + (let [members (<flattener> (/.anonymous headT))] (if (n.> 1 (list.size members)) (local members poly) (//.failure (exception.error <exception> headT)))))))] - [variant type.flat_variant ..not_variant] - [tuple type.flat_tuple ..not_tuple] + [variant /.flat_variant ..not_variant] + [tuple /.flat_tuple ..not_tuple] ) (def polymorphic' (Parser [Nat Type]) (do //.monad [headT any - .let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]] + .let [[num_arg bodyT] (/.flat_univ_q (/.anonymous headT))]] (if (n.= 0 num_arg) (//.failure (exception.error ..not_polymorphic headT)) (in [num_arg bodyT])))) @@ -218,7 +219,7 @@ (All (_ i o) (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any - .let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] + .let [[inputsT outputT] (/.flat_function (/.anonymous headT))]] (if (n.> 0 (list.size inputsT)) (//.and (local inputsT in_poly) (local (list outputT) out_poly)) @@ -228,7 +229,7 @@ (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT any - .let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] + .let [[funcT paramsT] (/.flat_application (/.anonymous headT))]] (if (n.= 0 (list.size paramsT)) (//.failure (exception.error ..not_application headT)) (..local {.#Item funcT paramsT} poly)))) @@ -242,7 +243,7 @@ (in []) (//.failure (exception.error ..types_do_not_match [expected actual])))))] - [exactly type#=] + [exactly /#=] [sub check.subsumes?] [super (function.flipped check.subsumes?)] ) @@ -311,7 +312,7 @@ (All (_ a) (-> (Parser a) (Parser [Code a]))) (do [! //.monad] [headT any] - (case (type.anonymous headT) + (case (/.anonymous headT) (pattern {.#Apply (|recursion_dummy|) {.#UnivQ _ headT'}}) (do ! [[recT _ output] (|> poly @@ -328,7 +329,7 @@ (do //.monad [env ..env headT any] - (case (type.anonymous headT) + (case (/.anonymous headT) (^.multi (pattern {.#Apply (|recursion_dummy|) {.#Parameter funcT_idx}}) (n.= 0 (..argument env funcT_idx)) [(dictionary.value 0 env) {.#Some [self_type self_call]}]) diff --git a/stdlib/source/parser/lux/program.lux b/stdlib/source/parser/lux/program.lux index e834136d8..eff42b3ad 100644 --- a/stdlib/source/parser/lux/program.lux +++ b/stdlib/source/parser/lux/program.lux @@ -59,9 +59,6 @@ (function (_ inputs) (loop (again [immediate inputs]) (case (//.result cli immediate) - {try.#Success [remaining output]} - {try.#Success [remaining output]} - {try.#Failure try} (case immediate {.#End} @@ -71,7 +68,10 @@ (do try.monad [[remaining output] (again immediate')] (in [{.#Item to_omit remaining} - output]))))))) + output]))) + + success + success)))) (def .public end (Parser Any) |