From 7e4c9ba2e02f06fa621ffe24bc0ca046536429ef Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 2 Jul 2022 16:32:00 -0400 Subject: Moved "lux/macro" to "lux/meta/macro". --- stdlib/source/documentation/lux/macro.lux | 99 -------- stdlib/source/documentation/lux/macro/local.lux | 27 --- stdlib/source/documentation/lux/macro/syntax.lux | 48 ---- .../documentation/lux/macro/syntax/check.lux | 23 -- .../documentation/lux/macro/syntax/declaration.lux | 28 --- .../documentation/lux/macro/syntax/definition.lux | 31 --- .../documentation/lux/macro/syntax/export.lux | 22 -- .../documentation/lux/macro/syntax/input.lux | 25 -- .../lux/macro/syntax/type/variable.lux | 25 -- stdlib/source/documentation/lux/macro/template.lux | 65 ------ stdlib/source/documentation/lux/meta/macro.lux | 99 ++++++++ .../source/documentation/lux/meta/macro/local.lux | 27 +++ .../source/documentation/lux/meta/macro/syntax.lux | 48 ++++ .../documentation/lux/meta/macro/syntax/check.lux | 23 ++ .../lux/meta/macro/syntax/declaration.lux | 28 +++ .../lux/meta/macro/syntax/definition.lux | 31 +++ .../documentation/lux/meta/macro/syntax/export.lux | 22 ++ .../documentation/lux/meta/macro/syntax/input.lux | 25 ++ .../lux/meta/macro/syntax/type/variable.lux | 25 ++ .../documentation/lux/meta/macro/template.lux | 65 ++++++ stdlib/source/format/lux/data/binary.lux | 7 +- stdlib/source/format/lux/data/text.lux | 8 +- .../source/library/lux/abstract/monad/indexed.lux | 6 +- .../source/library/lux/control/concatenative.lux | 8 +- .../library/lux/control/concurrency/actor.lux | 4 +- .../library/lux/control/concurrency/async.lux | 4 +- .../source/library/lux/control/concurrency/stm.lux | 4 +- stdlib/source/library/lux/control/continuation.lux | 6 +- stdlib/source/library/lux/control/exception.lux | 12 +- .../library/lux/control/function/contract.lux | 4 +- .../source/library/lux/control/function/inline.lux | 8 +- .../source/library/lux/control/function/mutual.lux | 10 +- stdlib/source/library/lux/control/io.lux | 12 +- stdlib/source/library/lux/control/lazy.lux | 10 +- stdlib/source/library/lux/control/pipe.lux | 6 +- stdlib/source/library/lux/control/remember.lux | 14 +- .../library/lux/control/security/capability.lux | 15 +- .../library/lux/data/collection/dictionary.lux | 7 +- .../lux/data/collection/dictionary/ordered.lux | 7 +- .../library/lux/data/collection/sequence.lux | 8 +- stdlib/source/library/lux/data/collection/set.lux | 7 +- .../library/lux/data/collection/set/multi.lux | 4 +- .../source/library/lux/data/collection/stream.lux | 6 +- stdlib/source/library/lux/data/collection/tree.lux | 6 +- .../source/library/lux/data/format/css/class.lux | 4 +- stdlib/source/library/lux/data/format/css/id.lux | 4 +- .../library/lux/data/format/css/property.lux | 8 +- .../source/library/lux/data/format/css/query.lux | 6 +- .../library/lux/data/format/css/selector.lux | 4 +- .../source/library/lux/data/format/css/value.lux | 12 +- stdlib/source/library/lux/data/format/html.lux | 4 +- stdlib/source/library/lux/data/format/json.lux | 8 +- stdlib/source/library/lux/data/format/markdown.lux | 6 +- stdlib/source/library/lux/data/format/tar.lux | 12 +- stdlib/source/library/lux/data/text.lux | 7 +- stdlib/source/library/lux/data/text/encoding.lux | 4 +- stdlib/source/library/lux/data/text/escape.lux | 8 +- stdlib/source/library/lux/data/text/regex.lux | 8 +- stdlib/source/library/lux/debug.lux | 20 +- stdlib/source/library/lux/documentation.lux | 10 +- stdlib/source/library/lux/extension.lux | 6 +- stdlib/source/library/lux/ffi.jvm.lux | 16 +- stdlib/source/library/lux/ffi.lux | 12 +- stdlib/source/library/lux/ffi.old.lux | 10 +- stdlib/source/library/lux/ffi.php.lux | 8 +- stdlib/source/library/lux/ffi.scm.lux | 8 +- stdlib/source/library/lux/ffi/export.js.lux | 6 +- stdlib/source/library/lux/ffi/export.jvm.lux | 6 +- stdlib/source/library/lux/ffi/export.lua.lux | 6 +- stdlib/source/library/lux/ffi/export.py.lux | 6 +- stdlib/source/library/lux/ffi/export.rb.lux | 6 +- stdlib/source/library/lux/locale/language.lux | 4 +- stdlib/source/library/lux/locale/territory.lux | 4 +- stdlib/source/library/lux/macro.lux | 214 ----------------- stdlib/source/library/lux/macro/context.lux | 159 ------------- stdlib/source/library/lux/macro/local.lux | 144 ------------ stdlib/source/library/lux/macro/pattern.lux | 256 --------------------- stdlib/source/library/lux/macro/syntax.lux | 99 -------- stdlib/source/library/lux/macro/syntax/check.lux | 41 ---- .../library/lux/macro/syntax/declaration.lux | 44 ---- .../source/library/lux/macro/syntax/definition.lux | 97 -------- stdlib/source/library/lux/macro/syntax/export.lux | 37 --- stdlib/source/library/lux/macro/syntax/input.lux | 43 ---- .../library/lux/macro/syntax/type/variable.lux | 25 -- stdlib/source/library/lux/macro/template.lux | 185 --------------- stdlib/source/library/lux/math.lux | 12 +- stdlib/source/library/lux/math/infix.lux | 6 +- stdlib/source/library/lux/math/modular.lux | 6 +- stdlib/source/library/lux/math/modulus.lux | 10 +- stdlib/source/library/lux/math/number.lux | 5 +- stdlib/source/library/lux/math/number/complex.lux | 6 +- stdlib/source/library/lux/math/number/frac.lux | 5 +- stdlib/source/library/lux/math/number/int.lux | 5 +- stdlib/source/library/lux/math/number/nat.lux | 5 +- stdlib/source/library/lux/math/number/ratio.lux | 6 +- stdlib/source/library/lux/math/random.lux | 8 +- stdlib/source/library/lux/meta.lux | 13 +- stdlib/source/library/lux/meta/code.lux | 6 +- stdlib/source/library/lux/meta/configuration.lux | 6 +- stdlib/source/library/lux/meta/macro.lux | 213 +++++++++++++++++ stdlib/source/library/lux/meta/macro/context.lux | 159 +++++++++++++ stdlib/source/library/lux/meta/macro/local.lux | 144 ++++++++++++ stdlib/source/library/lux/meta/macro/pattern.lux | 256 +++++++++++++++++++++ stdlib/source/library/lux/meta/macro/syntax.lux | 99 ++++++++ .../source/library/lux/meta/macro/syntax/check.lux | 41 ++++ .../library/lux/meta/macro/syntax/declaration.lux | 44 ++++ .../library/lux/meta/macro/syntax/definition.lux | 97 ++++++++ .../library/lux/meta/macro/syntax/export.lux | 37 +++ .../source/library/lux/meta/macro/syntax/input.lux | 43 ++++ .../lux/meta/macro/syntax/type/variable.lux | 25 ++ stdlib/source/library/lux/meta/macro/template.lux | 184 +++++++++++++++ stdlib/source/library/lux/meta/type.lux | 8 +- stdlib/source/library/lux/meta/type/check.lux | 7 +- stdlib/source/library/lux/meta/type/dynamic.lux | 6 +- stdlib/source/library/lux/meta/type/implicit.lux | 6 +- stdlib/source/library/lux/meta/type/poly.lux | 8 +- stdlib/source/library/lux/meta/type/primitive.lux | 12 +- stdlib/source/library/lux/meta/type/quotient.lux | 6 +- stdlib/source/library/lux/meta/type/refinement.lux | 6 +- stdlib/source/library/lux/meta/type/resource.lux | 6 +- stdlib/source/library/lux/meta/type/unit.lux | 6 +- stdlib/source/library/lux/meta/type/unit/scale.lux | 6 +- stdlib/source/library/lux/meta/version.lux | 6 +- stdlib/source/library/lux/program.lux | 6 +- stdlib/source/library/lux/static.lux | 6 +- stdlib/source/library/lux/target/common_lisp.lux | 4 +- stdlib/source/library/lux/target/js.lux | 4 +- stdlib/source/library/lux/target/jvm/attribute.lux | 7 +- stdlib/source/library/lux/target/jvm/bytecode.lux | 9 +- .../lux/target/jvm/bytecode/instruction.lux | 4 +- stdlib/source/library/lux/target/jvm/constant.lux | 6 +- .../library/lux/target/jvm/encoding/signed.lux | 4 +- .../library/lux/target/jvm/encoding/unsigned.lux | 4 +- stdlib/source/library/lux/target/jvm/modifier.lux | 10 +- .../source/library/lux/target/jvm/reflection.lux | 7 +- .../library/lux/target/jvm/type/category.lux | 4 +- stdlib/source/library/lux/target/lua.lux | 12 +- stdlib/source/library/lux/target/php.lux | 12 +- stdlib/source/library/lux/target/python.lux | 12 +- stdlib/source/library/lux/target/r.lux | 12 +- stdlib/source/library/lux/target/ruby.lux | 12 +- stdlib/source/library/lux/target/scheme.lux | 4 +- stdlib/source/library/lux/test.lux | 12 +- stdlib/source/library/lux/time/day.lux | 9 +- stdlib/source/library/lux/time/month.lux | 9 +- .../library/lux/tool/compiler/default/init.lux | 3 +- .../lux/tool/compiler/language/lux/analysis.lux | 6 +- .../compiler/language/lux/analysis/coverage.lux | 9 +- .../compiler/language/lux/analysis/inference.lux | 6 +- .../tool/compiler/language/lux/analysis/macro.lux | 4 +- .../tool/compiler/language/lux/analysis/module.lux | 4 +- .../tool/compiler/language/lux/analysis/simple.lux | 7 +- .../tool/compiler/language/lux/analysis/type.lux | 7 +- .../lux/tool/compiler/language/lux/generation.lux | 8 +- .../tool/compiler/language/lux/phase/analysis.lux | 6 +- .../compiler/language/lux/phase/analysis/case.lux | 4 +- .../language/lux/phase/analysis/reference.lux | 6 +- .../tool/compiler/language/lux/phase/extension.lux | 5 +- .../language/lux/phase/extension/analysis/jvm.lux | 6 +- .../language/lux/phase/extension/analysis/lux.lux | 4 +- .../lux/phase/extension/declaration/jvm.lux | 8 +- .../lux/phase/extension/declaration/lux.lux | 6 +- .../lux/phase/extension/generation/js/common.lux | 5 +- .../lux/phase/extension/generation/jvm/host.lux | 7 +- .../lux/phase/extension/generation/lua/common.lux | 5 +- .../phase/extension/generation/python/common.lux | 5 +- .../lux/phase/extension/generation/ruby/common.lux | 5 +- .../language/lux/phase/generation/common_lisp.lux | 5 +- .../lux/phase/generation/common_lisp/case.lux | 5 +- .../lux/phase/generation/common_lisp/runtime.lux | 6 +- .../language/lux/phase/generation/extension.lux | 6 +- .../compiler/language/lux/phase/generation/js.lux | 5 +- .../language/lux/phase/generation/js/case.lux | 5 +- .../language/lux/phase/generation/js/runtime.lux | 6 +- .../compiler/language/lux/phase/generation/jvm.lux | 5 +- .../language/lux/phase/generation/jvm/case.lux | 5 +- .../lux/phase/generation/jvm/primitive.lux | 5 +- .../compiler/language/lux/phase/generation/lua.lux | 5 +- .../language/lux/phase/generation/lua/case.lux | 5 +- .../language/lux/phase/generation/lua/runtime.lux | 6 +- .../compiler/language/lux/phase/generation/php.lux | 5 +- .../language/lux/phase/generation/php/case.lux | 5 +- .../language/lux/phase/generation/php/runtime.lux | 6 +- .../language/lux/phase/generation/python.lux | 5 +- .../language/lux/phase/generation/python/case.lux | 5 +- .../lux/phase/generation/python/runtime.lux | 6 +- .../compiler/language/lux/phase/generation/r.lux | 5 +- .../language/lux/phase/generation/r/case.lux | 7 +- .../language/lux/phase/generation/r/runtime.lux | 6 +- .../language/lux/phase/generation/ruby.lux | 5 +- .../language/lux/phase/generation/ruby/case.lux | 5 +- .../language/lux/phase/generation/ruby/runtime.lux | 6 +- .../language/lux/phase/generation/scheme.lux | 5 +- .../language/lux/phase/generation/scheme/case.lux | 7 +- .../phase/generation/scheme/extension/common.lux | 6 +- .../lux/phase/generation/scheme/runtime.lux | 6 +- .../tool/compiler/language/lux/phase/synthesis.lux | 5 +- .../compiler/language/lux/phase/synthesis/case.lux | 7 +- .../language/lux/phase/synthesis/function.lux | 7 +- .../compiler/language/lux/phase/synthesis/loop.lux | 7 +- .../language/lux/phase/synthesis/variable.lux | 7 +- .../lux/tool/compiler/language/lux/syntax.lux | 8 +- .../lux/tool/compiler/language/lux/synthesis.lux | 7 +- .../compiler/language/lux/synthesis/simple.lux | 7 +- .../compiler/meta/archive/artifact/category.lux | 7 +- .../compiler/meta/archive/module/descriptor.lux | 5 +- .../lux/tool/compiler/meta/archive/registry.lux | 4 +- .../compiler/meta/cache/dependency/artifact.lux | 6 +- .../source/library/lux/tool/compiler/meta/cli.lux | 6 +- .../library/lux/tool/compiler/meta/io/archive.lux | 6 +- .../source/library/lux/tool/compiler/reference.lux | 6 +- .../lux/tool/compiler/reference/variable.lux | 7 +- stdlib/source/library/lux/world/db/jdbc.lux | 8 +- stdlib/source/library/lux/world/db/jdbc/input.lux | 4 +- stdlib/source/library/lux/world/db/jdbc/output.lux | 4 +- stdlib/source/library/lux/world/db/sql.lux | 5 +- stdlib/source/library/lux/world/environment.lux | 7 +- stdlib/source/library/lux/world/file.lux | 5 +- .../source/library/lux/world/net/http/client.lux | 8 +- .../source/library/lux/world/net/http/request.lux | 5 +- .../source/library/lux/world/net/http/response.lux | 2 +- stdlib/source/library/lux/world/net/http/route.lux | 5 +- stdlib/source/parser/lux/data/binary.lux | 8 +- stdlib/source/parser/lux/data/text.lux | 8 +- stdlib/source/parser/lux/meta/type.lux | 6 +- .../lux/tool/compiler/language/lux/analysis.lux | 6 +- .../source/polytypic/lux/abstract/equivalence.lux | 14 +- stdlib/source/polytypic/lux/data/format/json.lux | 18 +- .../source/program/aedifex/artifact/extension.lux | 5 +- stdlib/source/program/aedifex/command/build.lux | 6 +- stdlib/source/program/aedifex/command/test.lux | 5 +- stdlib/source/program/aedifex/format.lux | 7 +- stdlib/source/program/aedifex/hash.lux | 9 +- stdlib/source/program/aedifex/profile.lux | 8 +- stdlib/source/program/aedifex/runtime.lux | 5 +- stdlib/source/program/compositor.lux | 3 +- .../specification/compositor/generation/common.lux | 5 +- stdlib/source/test/lux.lux | 12 +- stdlib/source/test/lux/control/concatenative.lux | 7 +- stdlib/source/test/lux/control/function/memo.lux | 5 +- stdlib/source/test/lux/control/function/mixin.lux | 7 +- stdlib/source/test/lux/control/parser.lux | 6 +- stdlib/source/test/lux/control/remember.lux | 6 +- stdlib/source/test/lux/control/security/policy.lux | 7 +- stdlib/source/test/lux/data/binary.lux | 8 +- stdlib/source/test/lux/data/collection/tree.lux | 7 +- stdlib/source/test/lux/data/color/named.lux | 7 +- stdlib/source/test/lux/data/format/json.lux | 6 +- stdlib/source/test/lux/data/format/tar.lux | 8 +- stdlib/source/test/lux/data/format/xml.lux | 8 +- stdlib/source/test/lux/data/text.lux | 6 +- stdlib/source/test/lux/data/text/encoding.lux | 7 +- stdlib/source/test/lux/data/text/escape.lux | 8 +- stdlib/source/test/lux/data/text/regex.lux | 6 +- stdlib/source/test/lux/data/text/unicode/block.lux | 7 +- stdlib/source/test/lux/debug.lux | 6 +- stdlib/source/test/lux/documentation.lux | 8 +- stdlib/source/test/lux/extension.lux | 6 +- stdlib/source/test/lux/ffi.jvm.lux | 8 +- stdlib/source/test/lux/ffi.old.lux | 7 +- stdlib/source/test/lux/ffi/export.jvm.lux | 6 +- stdlib/source/test/lux/locale/language.lux | 7 +- stdlib/source/test/lux/locale/territory.lux | 7 +- stdlib/source/test/lux/macro.lux | 250 -------------------- stdlib/source/test/lux/macro/context.lux | 12 - stdlib/source/test/lux/macro/local.lux | 130 ----------- stdlib/source/test/lux/macro/pattern.lux | 99 -------- stdlib/source/test/lux/macro/syntax.lux | 49 ---- stdlib/source/test/lux/macro/syntax/check.lux | 49 ---- .../source/test/lux/macro/syntax/declaration.lux | 49 ---- stdlib/source/test/lux/macro/syntax/definition.lux | 97 -------- stdlib/source/test/lux/macro/syntax/export.lux | 46 ---- stdlib/source/test/lux/macro/syntax/input.lux | 50 ---- .../source/test/lux/macro/syntax/type/variable.lux | 39 ---- stdlib/source/test/lux/macro/template.lux | 117 ---------- stdlib/source/test/lux/math.lux | 7 +- stdlib/source/test/lux/math/modulus.lux | 6 +- stdlib/source/test/lux/math/number/frac.lux | 7 +- stdlib/source/test/lux/meta.lux | 10 +- stdlib/source/test/lux/meta/code.lux | 6 +- stdlib/source/test/lux/meta/configuration.lux | 6 +- stdlib/source/test/lux/meta/macro.lux | 250 ++++++++++++++++++++ stdlib/source/test/lux/meta/macro/context.lux | 12 + stdlib/source/test/lux/meta/macro/local.lux | 130 +++++++++++ stdlib/source/test/lux/meta/macro/pattern.lux | 99 ++++++++ stdlib/source/test/lux/meta/macro/syntax.lux | 49 ++++ stdlib/source/test/lux/meta/macro/syntax/check.lux | 48 ++++ .../test/lux/meta/macro/syntax/declaration.lux | 48 ++++ .../test/lux/meta/macro/syntax/definition.lux | 96 ++++++++ .../source/test/lux/meta/macro/syntax/export.lux | 46 ++++ stdlib/source/test/lux/meta/macro/syntax/input.lux | 49 ++++ .../test/lux/meta/macro/syntax/type/variable.lux | 38 +++ stdlib/source/test/lux/meta/macro/template.lux | 117 ++++++++++ stdlib/source/test/lux/meta/symbol.lux | 7 +- stdlib/source/test/lux/meta/type.lux | 6 +- stdlib/source/test/lux/meta/type/check.lux | 7 +- stdlib/source/test/lux/meta/type/primitive.lux | 8 +- stdlib/source/test/lux/meta/type/resource.lux | 6 +- stdlib/source/test/lux/meta/type/unit/scale.lux | 6 +- stdlib/source/test/lux/meta/version.lux | 6 +- stdlib/source/test/lux/program.lux | 8 +- stdlib/source/test/lux/target/js.lux | 7 +- stdlib/source/test/lux/target/lua.lux | 7 +- .../lux/tool/compiler/language/lux/analysis.lux | 4 +- .../compiler/language/lux/analysis/coverage.lux | 7 +- .../compiler/language/lux/analysis/inference.lux | 2 +- .../tool/compiler/language/lux/analysis/macro.lux | 2 +- .../tool/compiler/language/lux/phase/analysis.lux | 2 +- .../compiler/language/lux/phase/analysis/case.lux | 2 +- .../language/lux/phase/analysis/complex.lux | 4 +- .../language/lux/phase/analysis/function.lux | 2 +- .../language/lux/phase/synthesis/function.lux | 7 +- .../language/lux/phase/synthesis/variable.lux | 9 +- .../lux/tool/compiler/language/lux/synthesis.lux | 6 +- stdlib/source/test/lux/world/file.lux | 5 +- stdlib/source/test/lux/world/input/keyboard.lux | 7 +- stdlib/source/test/lux/world/net/http/status.lux | 7 +- 317 files changed, 3593 insertions(+), 3517 deletions(-) delete mode 100644 stdlib/source/documentation/lux/macro.lux delete mode 100644 stdlib/source/documentation/lux/macro/local.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/check.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/declaration.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/definition.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/export.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/input.lux delete mode 100644 stdlib/source/documentation/lux/macro/syntax/type/variable.lux delete mode 100644 stdlib/source/documentation/lux/macro/template.lux create mode 100644 stdlib/source/documentation/lux/meta/macro.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/local.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/check.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/definition.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/export.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/input.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/syntax/type/variable.lux create mode 100644 stdlib/source/documentation/lux/meta/macro/template.lux delete mode 100644 stdlib/source/library/lux/macro.lux delete mode 100644 stdlib/source/library/lux/macro/context.lux delete mode 100644 stdlib/source/library/lux/macro/local.lux delete mode 100644 stdlib/source/library/lux/macro/pattern.lux delete mode 100644 stdlib/source/library/lux/macro/syntax.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/check.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/declaration.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/definition.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/export.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/input.lux delete mode 100644 stdlib/source/library/lux/macro/syntax/type/variable.lux delete mode 100644 stdlib/source/library/lux/macro/template.lux create mode 100644 stdlib/source/library/lux/meta/macro.lux create mode 100644 stdlib/source/library/lux/meta/macro/context.lux create mode 100644 stdlib/source/library/lux/meta/macro/local.lux create mode 100644 stdlib/source/library/lux/meta/macro/pattern.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/check.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/declaration.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/definition.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/export.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/input.lux create mode 100644 stdlib/source/library/lux/meta/macro/syntax/type/variable.lux create mode 100644 stdlib/source/library/lux/meta/macro/template.lux delete mode 100644 stdlib/source/test/lux/macro.lux delete mode 100644 stdlib/source/test/lux/macro/context.lux delete mode 100644 stdlib/source/test/lux/macro/local.lux delete mode 100644 stdlib/source/test/lux/macro/pattern.lux delete mode 100644 stdlib/source/test/lux/macro/syntax.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/check.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/declaration.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/definition.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/export.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/input.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/type/variable.lux delete mode 100644 stdlib/source/test/lux/macro/template.lux create mode 100644 stdlib/source/test/lux/meta/macro.lux create mode 100644 stdlib/source/test/lux/meta/macro/context.lux create mode 100644 stdlib/source/test/lux/meta/macro/local.lux create mode 100644 stdlib/source/test/lux/meta/macro/pattern.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/check.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/declaration.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/definition.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/export.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/input.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/type/variable.lux create mode 100644 stdlib/source/test/lux/meta/macro/template.lux (limited to 'stdlib/source') diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux deleted file mode 100644 index da66da131..000000000 --- a/stdlib/source/documentation/lux/macro.lux +++ /dev/null @@ -1,99 +0,0 @@ -(.require - [library - [lux (.except char symbol) - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - ["[0]" / - ["[1][0]" local] - ["[1][0]" syntax] - ["[1][0]" template]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.documentation /.single_expansion - (format "Given code that requires applying a macro, does it once and returns the result." - \n "Otherwise, returns the code as-is.") - [(single_expansion syntax)]) - - ($.documentation /.expansion - (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." - \n "Otherwise, returns the code as-is.") - [(expansion syntax)]) - - ($.documentation /.full_expansion - "Expands all macro-calls everywhere recursively, until only primitive/base code remains." - [(full_expansion syntax)]) - - ($.documentation /.symbol - (format "Generates a unique name as a Code node (ready to be used in code templates)." - \n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.") - [(symbol prefix)]) - - ($.documentation /.wrong_syntax_error - "A generic error message for macro syntax failures.") - - ($.documentation /.with_symbols - "Creates new symbols and offers them to the body expression." - [(def synchronized - (syntax (_ [lock any - body any]) - (with_symbols [g!lock g!body g!_] - (in (list (` (let [(, g!lock) (, lock) - (, g!_) ("jvm monitorenter" (, g!lock)) - (, g!body) (, body) - (, g!_) ("jvm monitorexit" (, g!lock))] - (, g!body))))))))]) - - ($.documentation /.one_expansion - "Works just like expand, except that it ensures that the output is a single Code token." - [(one_expansion token)]) - - ($.documentation /.log_single_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_single_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_single_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))]) - - ($.documentation /.log_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))]) - - ($.documentation /.log_full_expansion! - (format "Performs a macro-expansion and logs the resulting code." - \n "You can either use the resulting code, or omit them." - \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") - [(log_full_expansion! - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz))) - (log_full_expansion! "omit" - (def (foo bar baz) - (-> Int Int Int) - (int.+ bar baz)))])] - [/local.documentation - /syntax.documentation - /template.documentation])) diff --git a/stdlib/source/documentation/lux/macro/local.lux b/stdlib/source/documentation/lux/macro/local.lux deleted file mode 100644 index e71a685fb..000000000 --- a/stdlib/source/documentation/lux/macro/local.lux +++ /dev/null @@ -1,27 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.unknown_module) - ($.default /.cannot_shadow_definition) - ($.default /.unknown_definition) - - ($.documentation /.push - (format "Installs macros in the compiler-state, with the given names." - \n "Yields code that can be placed either as expression or as declarations." - \n "This code un-installs the macros." - \n "NOTE: Always use this code once to clean-up..") - [(push macros)])] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux deleted file mode 100644 index 30dd6b08a..000000000 --- a/stdlib/source/documentation/lux/macro/syntax.lux +++ /dev/null @@ -1,48 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - ["[0]" / - ["[1][0]" check] - ["[1][0]" declaration] - ["[1][0]" definition] - ["[1][0]" export] - ["[1][0]" input] - ["[1][0]" type - ["[1]/[0]" variable]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.documentation /.syntax - (format \n "A more advanced way to define macros than 'macro'." - \n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers." - \n "The macro body is also (implicitly) run in the Meta monad, to save some typing." - \n "Also, the compiler state can be accessed through a special binding.") - [(def .public object - (syntax (_ lux_state [.let [imports (class_imports lux_state)] - .let [class_vars (list)] - super (opt (super_class_decl^ imports class_vars)) - interfaces (tuple (some (super_class_decl^ imports class_vars))) - constructor_args (constructor_args^ imports class_vars) - methods (some (overriden_method_def^ imports))]) - (let [def_code (all text#composite "anon-class:" - (spaced (list (super_class_decl$ (maybe.else object_super_class super)) - (with_brackets (spaced (list#each super_class_decl$ interfaces))) - (with_brackets (spaced (list#each constructor_arg$ constructor_args))) - (with_brackets (spaced (list#each (method_def$ id) methods))))))] - (in (list (` ((, (code.text def_code)))))))))])] - [/check.documentation - /declaration.documentation - /definition.documentation - /export.documentation - /input.documentation - /type/variable.documentation])) diff --git a/stdlib/source/documentation/lux/macro/syntax/check.lux b/stdlib/source/documentation/lux/macro/syntax/check.lux deleted file mode 100644 index c96bf0cde..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/check.lux +++ /dev/null @@ -1,23 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.equivalence) - ($.default /.format) - ($.default /.parser) - - ($.documentation /.Check - "A type annotation for an expression.")] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/macro/syntax/declaration.lux deleted file mode 100644 index fd9fe1a58..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/declaration.lux +++ /dev/null @@ -1,28 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.equivalence) - ($.default /.format) - - ($.documentation /.Declaration - "A declaration for either a constant or a function.") - - ($.documentation /.parser - "A parser for declaration syntax." - ["Such as:" - quux - (foo bar baz)])] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/definition.lux b/stdlib/source/documentation/lux/macro/syntax/definition.lux deleted file mode 100644 index cf4b3225f..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/definition.lux +++ /dev/null @@ -1,31 +0,0 @@ -(.require - [library - [lux (.except Definition) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.equivalence) - ($.default /.lacks_type) - ($.default /.format) - - ($.documentation /.Definition - "Syntax for a constant definition.") - - ($.documentation /.parser - "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition." - [(parser compiler)]) - - ($.documentation /.typed - "Only works for typed definitions." - [(typed compiler)])] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/export.lux b/stdlib/source/documentation/lux/macro/syntax/export.lux deleted file mode 100644 index 6d23bc8b9..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/export.lux +++ /dev/null @@ -1,22 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "Syntax for marking a definition as an export." - [($.default /.default_policy) - - ($.documentation /.parser - "" - [(parser un_exported)])] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/input.lux b/stdlib/source/documentation/lux/macro/syntax/input.lux deleted file mode 100644 index 77a6b7cac..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/input.lux +++ /dev/null @@ -1,25 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.equivalence) - ($.default /.format) - - ($.documentation /.Input - "The common typed-argument syntax used by many macros.") - - ($.documentation /.parser - "Parser for the common typed-argument syntax used by many macros.")] - [])) diff --git a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux deleted file mode 100644 index c29df1817..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux +++ /dev/null @@ -1,25 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.equivalence) - ($.default /.format) - - ($.documentation /.Variable - "A variable's name.") - - ($.documentation /.parser - "Parser for the common type variable/parameter used by many macros.")] - [])) diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux deleted file mode 100644 index e75bbfbd9..000000000 --- a/stdlib/source/documentation/lux/macro/template.lux +++ /dev/null @@ -1,65 +0,0 @@ -(.require - [library - [lux (.except let symbol) - ["$" documentation] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "Utilities commonly used while templating." - [($.default /.irregular_arguments) - - ($.documentation /.spliced - "" - [(spliced [a b c d]) - "=>" - a - b - c - d]) - - ($.documentation /.amount - "" - [(amount [a b c d]) - "=>" - 4]) - - ($.documentation /.with_locals - "Creates names for local bindings aliased by the names you choose." - [(with_locals [my_var] - (let [my_var 123] - (text [my_var]))) - "=>" - "__gensym__my_var506"]) - - ($.documentation /.text - "A text literal made by concatenating pieces of code." - [(text [#0 123 +456 +789.0 "abc" .def ..ghi]) - "=>" - "#0123+456+789.0abcdefghi"]) - - ($.documentation /.symbol - (format "An symbol made by concatenating pieces of code." - \n "The (optional) module part and the short part are specified independently.") - [(symbol ["abc" .def ..ghi]) - "=>" - abcdefghi] - [(symbol [.def] ["abc" .def ..ghi]) - "=>" - .abcdefghi]) - - ($.documentation /.let - "Lexically-bound templates." - [(let [(!square ) - [(* )]] - (def (square root) - (-> Nat Nat) - (!square root)))])] - [])) diff --git a/stdlib/source/documentation/lux/meta/macro.lux b/stdlib/source/documentation/lux/meta/macro.lux new file mode 100644 index 000000000..da66da131 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro.lux @@ -0,0 +1,99 @@ +(.require + [library + [lux (.except char symbol) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + ["[0]" / + ["[1][0]" local] + ["[1][0]" syntax] + ["[1][0]" template]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.documentation /.single_expansion + (format "Given code that requires applying a macro, does it once and returns the result." + \n "Otherwise, returns the code as-is.") + [(single_expansion syntax)]) + + ($.documentation /.expansion + (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left." + \n "Otherwise, returns the code as-is.") + [(expansion syntax)]) + + ($.documentation /.full_expansion + "Expands all macro-calls everywhere recursively, until only primitive/base code remains." + [(full_expansion syntax)]) + + ($.documentation /.symbol + (format "Generates a unique name as a Code node (ready to be used in code templates)." + \n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.") + [(symbol prefix)]) + + ($.documentation /.wrong_syntax_error + "A generic error message for macro syntax failures.") + + ($.documentation /.with_symbols + "Creates new symbols and offers them to the body expression." + [(def synchronized + (syntax (_ [lock any + body any]) + (with_symbols [g!lock g!body g!_] + (in (list (` (let [(, g!lock) (, lock) + (, g!_) ("jvm monitorenter" (, g!lock)) + (, g!body) (, body) + (, g!_) ("jvm monitorexit" (, g!lock))] + (, g!body))))))))]) + + ($.documentation /.one_expansion + "Works just like expand, except that it ensures that the output is a single Code token." + [(one_expansion token)]) + + ($.documentation /.log_single_expansion! + (format "Performs a macro-expansion and logs the resulting code." + \n "You can either use the resulting code, or omit them." + \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + [(log_single_expansion! + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz))) + (log_single_expansion! "omit" + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz)))]) + + ($.documentation /.log_expansion! + (format "Performs a macro-expansion and logs the resulting code." + \n "You can either use the resulting code, or omit them." + \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + [(log_expansion! + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz))) + (log_expansion! "omit" + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz)))]) + + ($.documentation /.log_full_expansion! + (format "Performs a macro-expansion and logs the resulting code." + \n "You can either use the resulting code, or omit them." + \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") + [(log_full_expansion! + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz))) + (log_full_expansion! "omit" + (def (foo bar baz) + (-> Int Int Int) + (int.+ bar baz)))])] + [/local.documentation + /syntax.documentation + /template.documentation])) diff --git a/stdlib/source/documentation/lux/meta/macro/local.lux b/stdlib/source/documentation/lux/meta/macro/local.lux new file mode 100644 index 000000000..e71a685fb --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/local.lux @@ -0,0 +1,27 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.unknown_module) + ($.default /.cannot_shadow_definition) + ($.default /.unknown_definition) + + ($.documentation /.push + (format "Installs macros in the compiler-state, with the given names." + \n "Yields code that can be placed either as expression or as declarations." + \n "This code un-installs the macros." + \n "NOTE: Always use this code once to clean-up..") + [(push macros)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax.lux b/stdlib/source/documentation/lux/meta/macro/syntax.lux new file mode 100644 index 000000000..30dd6b08a --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + ["[0]" / + ["[1][0]" check] + ["[1][0]" declaration] + ["[1][0]" definition] + ["[1][0]" export] + ["[1][0]" input] + ["[1][0]" type + ["[1]/[0]" variable]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.documentation /.syntax + (format \n "A more advanced way to define macros than 'macro'." + \n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers." + \n "The macro body is also (implicitly) run in the Meta monad, to save some typing." + \n "Also, the compiler state can be accessed through a special binding.") + [(def .public object + (syntax (_ lux_state [.let [imports (class_imports lux_state)] + .let [class_vars (list)] + super (opt (super_class_decl^ imports class_vars)) + interfaces (tuple (some (super_class_decl^ imports class_vars))) + constructor_args (constructor_args^ imports class_vars) + methods (some (overriden_method_def^ imports))]) + (let [def_code (all text#composite "anon-class:" + (spaced (list (super_class_decl$ (maybe.else object_super_class super)) + (with_brackets (spaced (list#each super_class_decl$ interfaces))) + (with_brackets (spaced (list#each constructor_arg$ constructor_args))) + (with_brackets (spaced (list#each (method_def$ id) methods))))))] + (in (list (` ((, (code.text def_code)))))))))])] + [/check.documentation + /declaration.documentation + /definition.documentation + /export.documentation + /input.documentation + /type/variable.documentation])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/check.lux b/stdlib/source/documentation/lux/meta/macro/syntax/check.lux new file mode 100644 index 000000000..c96bf0cde --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/check.lux @@ -0,0 +1,23 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.equivalence) + ($.default /.format) + ($.default /.parser) + + ($.documentation /.Check + "A type annotation for an expression.")] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux new file mode 100644 index 000000000..fd9fe1a58 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/declaration.lux @@ -0,0 +1,28 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.equivalence) + ($.default /.format) + + ($.documentation /.Declaration + "A declaration for either a constant or a function.") + + ($.documentation /.parser + "A parser for declaration syntax." + ["Such as:" + quux + (foo bar baz)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux b/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux new file mode 100644 index 000000000..cf4b3225f --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/definition.lux @@ -0,0 +1,31 @@ +(.require + [library + [lux (.except Definition) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.equivalence) + ($.default /.lacks_type) + ($.default /.format) + + ($.documentation /.Definition + "Syntax for a constant definition.") + + ($.documentation /.parser + "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition." + [(parser compiler)]) + + ($.documentation /.typed + "Only works for typed definitions." + [(typed compiler)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/export.lux b/stdlib/source/documentation/lux/meta/macro/syntax/export.lux new file mode 100644 index 000000000..6d23bc8b9 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/export.lux @@ -0,0 +1,22 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "Syntax for marking a definition as an export." + [($.default /.default_policy) + + ($.documentation /.parser + "" + [(parser un_exported)])] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/input.lux b/stdlib/source/documentation/lux/meta/macro/syntax/input.lux new file mode 100644 index 000000000..77a6b7cac --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/input.lux @@ -0,0 +1,25 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.equivalence) + ($.default /.format) + + ($.documentation /.Input + "The common typed-argument syntax used by many macros.") + + ($.documentation /.parser + "Parser for the common typed-argument syntax used by many macros.")] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/meta/macro/syntax/type/variable.lux new file mode 100644 index 000000000..c29df1817 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/syntax/type/variable.lux @@ -0,0 +1,25 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.equivalence) + ($.default /.format) + + ($.documentation /.Variable + "A variable's name.") + + ($.documentation /.parser + "Parser for the common type variable/parameter used by many macros.")] + [])) diff --git a/stdlib/source/documentation/lux/meta/macro/template.lux b/stdlib/source/documentation/lux/meta/macro/template.lux new file mode 100644 index 000000000..e75bbfbd9 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/macro/template.lux @@ -0,0 +1,65 @@ +(.require + [library + [lux (.except let symbol) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "Utilities commonly used while templating." + [($.default /.irregular_arguments) + + ($.documentation /.spliced + "" + [(spliced [a b c d]) + "=>" + a + b + c + d]) + + ($.documentation /.amount + "" + [(amount [a b c d]) + "=>" + 4]) + + ($.documentation /.with_locals + "Creates names for local bindings aliased by the names you choose." + [(with_locals [my_var] + (let [my_var 123] + (text [my_var]))) + "=>" + "__gensym__my_var506"]) + + ($.documentation /.text + "A text literal made by concatenating pieces of code." + [(text [#0 123 +456 +789.0 "abc" .def ..ghi]) + "=>" + "#0123+456+789.0abcdefghi"]) + + ($.documentation /.symbol + (format "An symbol made by concatenating pieces of code." + \n "The (optional) module part and the short part are specified independently.") + [(symbol ["abc" .def ..ghi]) + "=>" + abcdefghi] + [(symbol [.def] ["abc" .def ..ghi]) + "=>" + .abcdefghi]) + + ($.documentation /.let + "Lexically-bound templates." + [(let [(!square ) + [(* )]] + (def (square root) + (-> Nat Nat) + (!square root)))])] + [])) diff --git a/stdlib/source/format/lux/data/binary.lux b/stdlib/source/format/lux/data/binary.lux index 8d31c23cc..761176a3a 100644 --- a/stdlib/source/format/lux/data/binary.lux +++ b/stdlib/source/format/lux/data/binary.lux @@ -22,13 +22,14 @@ ["[0]" set (.only Set)] [array [\\unsafe (.only)]]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["[0]" i64] - ["[0]" frac]]]]] + ["[0]" frac]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" \\unsafe (.only Binary)] ["" \\parser (.only Offset Size Parser)]) diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux index 531bd282b..2cbf6d99c 100644 --- a/stdlib/source/format/lux/data/text.lux +++ b/stdlib/source/format/lux/data/text.lux @@ -29,15 +29,15 @@ ["[0]" rev] ["[0]" frac] ["[0]" ratio]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [meta ["[0]" location] ["[0]" symbol] ["[0]" type] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)] + ["[0]" template]]]]]) (.type .public (Format a) (-> a Text)) diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index f6dd6a461..c321b7c3d 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -6,11 +6,11 @@ [data [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] ["[0]" //]) (type .public (IxMonad m) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index ac78d307a..d82d73232 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -11,9 +11,6 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" mix functor)]]] - ["[0]" macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] @@ -23,7 +20,10 @@ ["[0]" meta (.only) ["[0]" type] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]]]]] [// ["<>" parser (.use "[1]#[0]" monad)]]) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index f6141f32d..7d7d7ca93 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -11,9 +11,9 @@ [data ["[0]" bit] ["[0]" product]] - [macro - ["[0]" local]] [meta + [macro + ["[0]" local]] [type (.only sharing) [primitive (.only primitive representation abstraction)]]]]] [// diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 37ab82cbe..822627610 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -12,9 +12,9 @@ ["[0]" maybe (.use "[1]#[0]" functor)]] [data ["[0]" product]] - [macro - ["^" pattern]] [meta + [macro + ["^" pattern]] [type (.only sharing) [primitive (.except)] ["[0]" variance (.only Mutable)]]]]] diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 3beedf568..80a363c74 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -13,9 +13,9 @@ ["[0]" product] [collection ["[0]" list]]] - [macro - ["^" pattern]] [meta + [macro + ["^" pattern]] [type (.only sharing) [primitive (.except)] ["[0]" variance (.only Mutable)]]]]] diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux index 756804d7d..b0cda3ba1 100644 --- a/stdlib/source/library/lux/control/continuation.lux +++ b/stdlib/source/library/lux/control/continuation.lux @@ -7,11 +7,11 @@ [monad (.only Monad do)]] [control ["[0]" function]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)]]]]]) (type .public (Cont i o) (-> (-> i o) o)) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index cf9c51105..f07793cbd 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -11,17 +11,17 @@ ["[0]" text (.use "[1]#[0]" monoid)] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - ["[0]" macro (.only) - [syntax (.only syntax) - ["|[0]|" input] - ["[0]" type - ["|[1]_[0]|" variable]]]] [math [number ["n" nat (.use "[1]#[0]" decimal)]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax) + ["|[0]|" input] + ["[0]" type + ["|[1]_[0]|" variable]]]]]]] [// ["//" try (.only Try)]]) diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 7b093341f..88a27dd5e 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -6,12 +6,12 @@ [data [text ["%" \\format (.only format)]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [math [number ["i" int]]] [meta + [macro (.only with_symbols) + [syntax (.only syntax)]] ["[0]" code (.only) ["<[1]>" \\parser]]]]]) diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index 135674144..299e0165f 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -8,12 +8,12 @@ [data [collection ["[0]" list (.use "[1]#[0]" monad)]]] - ["[0]" macro (.only) - [syntax (.only syntax) - ["|[0]|" export]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax) + ["|[0]|" export]]]]]]) (def declaration (Parser [Text (List Code)]) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 0dcf766f5..150d0f49f 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -12,13 +12,13 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - ["[0]" macro (.only) - ["[0]" local] - [syntax (.only syntax) - ["[0]" declaration (.only Declaration)]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + ["[0]" local] + [syntax (.only syntax) + ["[0]" declaration (.only Declaration)]]]]]] ["[0]" //]) (type Mutual diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index 318c96682..a4789fe50 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -5,14 +5,14 @@ [functor (.only Functor)] [apply (.only Apply)] [monad (.only Monad do)]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] [meta - [type - [primitive (.except)]] ["[0]" code - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) (primitive .public (IO a) (-> Any a) diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index b280b48e0..aaf3aafe6 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -10,13 +10,13 @@ ["[0]" io] [concurrency ["[0]" atom]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [meta - [type (.only sharing) - [primitive (.except)]] ["[0]" code - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)]] + [type (.only sharing) + [primitive (.except)]]]]]) (primitive .public (Lazy a) (-> [] a) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index b16b4a167..23990201d 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -10,15 +10,15 @@ ["[0]" identity] [collection ["[0]" list (.use "[1]#[0]" monad)]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [math [number ["n" nat] ["i" int]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)]]]]]) (def body (Parser (List Code)) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 5165e2800..2900ee735 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -11,15 +11,15 @@ [data ["[0]" text ["%" \\format (.only format)]]] - [time - ["[0]" instant] - ["[0]" date (.only Date) (.use "[1]#[0]" order)]] - [macro - [syntax (.only syntax)] - ["[0]" template]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)] + ["[0]" template]]] + [time + ["[0]" instant] + ["[0]" date (.only Date) (.use "[1]#[0]" order)]]]]) (exception .public (must_remember [deadline Date today Date diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 1a2cb4ed3..434bb215c 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -13,16 +13,15 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [meta - [type - [primitive (.except)]]] - ["[0]" macro (.only) - [syntax (.only syntax) - ["|[0]|" export] - ["|[0]|" declaration]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax) + ["|[0]|" export] + ["|[0]|" declaration]]] + [type + [primitive (.except)]]]]]) (primitive .public (Capability brand input output) (-> input output) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index cd14464e8..dcbaf5621 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -16,12 +16,13 @@ ["[0]" list (.use "[1]#[0]" mix functor monoid)] ["[0]" array ["[1]" \\unsafe (.only Array)]]]] - [macro - ["^" pattern]] [math ["[0]" number (.only) ["n" nat] - ["[0]" i64]]]]]) + ["[0]" i64]]] + [meta + [macro + ["^" pattern]]]]]) ... This implementation of Hash Array Mapped Trie (HAMT) is based on ... Clojure's PersistentHashMap implementation. diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 77729c0b3..4f0254bbb 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -11,11 +11,12 @@ ["p" product] [collection ["[0]" list (.use "[1]#[0]" monoid mix)]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]]) + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]]) (def error_message "Invariant violation") diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 93bea49d4..e24e762d2 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -25,16 +25,16 @@ ["[0]" list (.use "[1]#[0]" mix functor monoid)] ["[0]" array ["[1]" \\unsafe (.only Array)]]]] - [macro - [syntax (.only syntax)] - ["^" pattern]] [math [number ["n" nat] ["[0]" i64]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)] + ["^" pattern]]]]]) (type (Node a) (Variant diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 049acac93..e3bf42911 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -11,11 +11,12 @@ [data [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // ["[1]" dictionary (.only Dictionary)]]) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index 0b0f1735e..3b3e2039d 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -8,12 +8,12 @@ [control ["[0]" function] ["[0]" maybe]] - [macro - ["^" pattern]] [math [number ["n" nat]]] [meta + [macro + ["^" pattern]] [type ["[0]" primitive (.only primitive abstraction representation)]]]]] ["[0]" // (.only) diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux index 67708962c..e0b2088ee 100644 --- a/stdlib/source/library/lux/data/collection/stream.lux +++ b/stdlib/source/library/lux/data/collection/stream.lux @@ -11,14 +11,14 @@ ["[0]" bit] [collection ["[0]" list (.use "[1]#[0]" monad)]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [math [number ["n" nat]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)]]]]]) (type .public (Stream a) (Cont [a (Stream a)])) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 7bde19f24..4ac0e5bed 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -11,11 +11,11 @@ [data [collection ["[0]" list (.use "[1]#[0]" monad mix)]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)]]]]]) (type .public (Tree a) (Record diff --git a/stdlib/source/library/lux/data/format/css/class.lux b/stdlib/source/library/lux/data/format/css/class.lux index 1ddfdfebd..b7bc2409e 100644 --- a/stdlib/source/library/lux/data/format/css/class.lux +++ b/stdlib/source/library/lux/data/format/css/class.lux @@ -7,10 +7,10 @@ [data ["[0]" text (.use "[1]#[0]" hash) ["%" \\format (.only format)]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code] + [macro + [syntax (.only syntax)]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux index 45746b427..637e9915e 100644 --- a/stdlib/source/library/lux/data/format/css/id.lux +++ b/stdlib/source/library/lux/data/format/css/id.lux @@ -7,10 +7,10 @@ [data ["[0]" text (.use "[1]#[0]" hash) ["%" \\format (.only format)]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code] + [macro + [syntax (.only syntax)]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 353efa6c5..c537a0a0e 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -3,13 +3,13 @@ [lux (.except All Location) [data ["[0]" text]] - [macro - [syntax (.only syntax)] - ["[0]" template] - ["[0]" code]] [meta [code ["s" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template] + ["[0]" code]] [type [primitive (.except)]]]]] [// diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux index 859eb7910..ab8d92644 100644 --- a/stdlib/source/library/lux/data/format/css/query.lux +++ b/stdlib/source/library/lux/data/format/css/query.lux @@ -4,12 +4,12 @@ [data ["[0]" text (.only) ["%" \\format (.only format)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [meta ["[0]" code (.only syntax) ["s" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] [type [primitive (.except)]]]]] ["[0]" // diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index a994398fd..b584c1a4a 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -8,9 +8,9 @@ [math [number ["i" int]]] - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]] ["[0]" // diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 877e4f8e6..3845d2cb6 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -10,9 +10,6 @@ ["%" \\format (.only Format format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] @@ -20,10 +17,13 @@ ["r" rev] ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]] [world [net (.only URL)]]]] [// diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index ba8f5ab31..0bdc6984b 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -10,9 +10,9 @@ ["%" \\format (.only Format format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]] [target diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 1af453bb9..a7aecfd6b 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -21,16 +21,16 @@ ["[0]" list (.use "[1]#[0]" mix functor)] ["[0]" sequence (.only Sequence sequence) (.use "[1]#[0]" monad)] ["[0]" dictionary (.only Dictionary)]]] - [macro - [syntax (.only syntax)] - ["^" pattern]] [math [number ["n" nat] ["f" frac (.use "[1]#[0]" decimal)]]] ["[0]" meta (.only monad) ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["^" pattern]]]]]) (with_template [ ] [(type .public diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index ad8a20186..4b8e1a4a2 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -6,11 +6,11 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [world - [net (.only URL)]] [meta [type - [primitive (.except)]]]]]) + [primitive (.except)]]] + [world + [net (.only URL)]]]]) ... https://www.markdownguide.org/basic-syntax/ diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 38746e8eb..32ec4bdaa 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -24,20 +24,20 @@ ["[0]" sequence (.only Sequence) (.use "[1]#[0]" mix)] [array [\\unsafe (.only)]]]] - [macro - ["^" pattern]] [math ["[0]" number (.only) ["n" nat] ["[0]" i64]]] + [meta + [macro + ["^" pattern]] + [type + [primitive (.except)]]] [time ["[0]" instant (.only Instant)] ["[0]" duration]] [world - ["[0]" file]] - [meta - [type - [primitive (.except)]]]]]) + ["[0]" file]]]]) (type Size Nat) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 3ab11ff3a..b9e6d0d07 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -14,12 +14,13 @@ [data [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - ["^" pattern]] [math [number ["n" nat] - ["[0]" i64]]]]]) + ["[0]" i64]]] + [meta + [macro + ["^" pattern]]]]]) (type .public Char Nat) diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux index 25b91cfc0..5906ebf3b 100644 --- a/stdlib/source/library/lux/data/text/encoding.lux +++ b/stdlib/source/library/lux/data/text/encoding.lux @@ -1,9 +1,9 @@ (.require [library [lux (.except) - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index 9963627fb..6dc9c137f 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -11,12 +11,12 @@ [math [number (.only hex) ["n" nat]]] - [macro - [syntax (.only syntax)] - ["^" pattern]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["^" pattern]]]]] ["[0]" // (.only Char) ["%" \\format (.only format)]]) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 674a53f67..c78edc826 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -14,15 +14,15 @@ ["<[1]>" \\parser (.only Parser)]] [collection ["[0]" list (.use "[1]#[0]" mix monad)]]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["^" pattern]] [math [number (.only hex) ["n" nat (.use "[1]#[0]" decimal)]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["^" pattern]]]]] ["[0]" // (.only) ["%" \\format (.only format)]]) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 6813e7cc2..2b27378b6 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -22,26 +22,26 @@ ["[0]" array] ["[0]" list (.use "[1]#[0]" monad)] ["[0]" dictionary]]] - [macro - ["^" pattern] - ["[0]" template] - ["[0]" syntax (.only syntax)]] [math [number [ratio (.only Ratio)] ["n" nat] ["i" int]]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser]] + [macro + ["^" pattern] + ["[0]" template] + ["[0]" syntax (.only syntax)]] + ["[0]" type (.only) + ["<[1]>" \\parser (.only Parser)]]] [time (.only Time) [instant (.only Instant)] [duration (.only Duration)] [date (.only Date)] [month (.only Month)] - [day (.only Day)]] - [meta - ["[0]" type (.only) - ["<[1]>" \\parser (.only Parser)]] - ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + [day (.only Day)]]]]) (with_expansions [ (these (import java/lang/String "[1]::[0]") diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index 128cf5780..eb030edec 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -18,17 +18,17 @@ ["[0]" stream (.only Stream)]] [format ["md" markdown (.only Markdown Block)]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["^" pattern] - ["[0]" template]] [math [number ["n" nat]]] ["[0]" meta (.only) ["[0]" type (.use "[1]#[0]" equivalence)] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" template]]] [tool [compiler [language diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index de3c150af..8fcfd5a96 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -9,11 +9,11 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["" \\parser (.only Parser)]]] + ["" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)]]] [tool [compiler ["[0]" phase] diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 5beaf4478..40db8e0c3 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -19,19 +19,19 @@ ["[0]" array] ["[0]" list (.use "[1]#[0]" monad mix monoid)] ["[0]" dictionary (.only Dictionary)]]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["^" pattern] - ["[0]" template] - ["[0]" context]] [math [number ["n" nat]]] [meta - ["[0]" type (.use "[1]#[0]" equivalence) - ["[0]" check]] ["[0]" code (.only) - ["<[1]>" \\parser(.only Parser)]]] + ["<[1]>" \\parser(.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" template] + ["[0]" context]] + ["[0]" type (.use "[1]#[0]" equivalence) + ["[0]" check]]] [target ["[0]" jvm [encoding diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index 3dd10ebe6..e204a0a4c 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -15,14 +15,14 @@ ["%" \\format]] [collection ["[0]" list (.use "[1]#[0]" monad mix)]]] - ["[0]" macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]] ["@" target (.only) ["[0]" js]]]]) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 329fce274..802c3ba9a 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -18,14 +18,14 @@ [collection ["[0]" array (.only Array)] ["[0]" list (.use "[1]#[0]" monad mix monoid)]]] - ["[0]" macro (.only with_symbols) - [syntax (.only syntax)] - ["^" pattern] - ["[0]" template]] ["[0]" meta (.only) ["[0]" type (.use "[1]#[0]" equivalence)] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" template]]]]]) (with_template [ ] [(def .public ( value) diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index fecdf259a..87279aaf1 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -14,14 +14,14 @@ ["%" \\format]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" meta (.only) [type abstract] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]]]]]) (primitive .public (Object brand) Any) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index a324365fa..7ba628f1d 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -14,14 +14,14 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" meta (.only) [type abstract] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]]]]]) (primitive .public (Object brand) Any) diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index 511ef27a2..67f97651d 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -13,13 +13,13 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" set]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [target ["/" js]] [tool diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux index 95a779da2..ddd8f9d50 100644 --- a/stdlib/source/library/lux/ffi/export.jvm.lux +++ b/stdlib/source/library/lux/ffi/export.jvm.lux @@ -6,11 +6,11 @@ [data [collection ["[0]" list (.use "[1]#[0]" monad)]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)]]]]] ["[0]" //]) (type (API of) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index 13efe101b..3d1b6e068 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -13,13 +13,13 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" set]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [target ["/" lua]] [tool diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 9427d0b4c..bbcc9c295 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -13,13 +13,13 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" set]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [target ["/" python]] [tool diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index f11e4e0c4..56d67edca 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -15,13 +15,13 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" set]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [target ["/" ruby]] [tool diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index c5b008d11..ae11c87b1 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -6,9 +6,9 @@ [hash (.only Hash)]] [data ["[0]" text]] - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index 153e0afd9..74c30fce6 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -6,9 +6,9 @@ [hash (.only Hash)]] [data ["[0]" text]] - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux deleted file mode 100644 index cc5c46d6d..000000000 --- a/stdlib/source/library/lux/macro.lux +++ /dev/null @@ -1,214 +0,0 @@ -(.require - [library - [lux (.except local symbol function macro) - [abstract - ["[0]" monad (.only do)]] - [data - ["[0]" text (.use "[1]#[0]" monoid)] - [collection - ["[0]" list (.use "[1]#[0]" monoid monad)]]] - [math - [number - ["[0]" nat] - ["[0]" int]]]]] - ["[0]" // - ["[1]" meta (.only) - ["[0]" code] - ["[0]" location] - ["[0]" symbol (.use "[1]#[0]" codec)]]]) - -(def .public (single_expansion syntax) - (-> Code (Meta (List Code))) - (case syntax - [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] - (do //.monad - [?macro (//.macro name)] - (case ?macro - {.#Some macro} - ((as Macro' macro) args) - - {.#None} - (at //.monad in (list syntax)))) - - _ - (at //.monad in (list syntax)))) - -(def .public (expansion syntax) - (-> Code (Meta (List Code))) - (case syntax - [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] - (do //.monad - [?macro (//.macro name)] - (case ?macro - {.#Some macro} - (do [! //.monad] - [top_level_expansion ((as Macro' macro) args)] - (|> top_level_expansion - (monad.each //.monad expansion) - (at ! each list#conjoint))) - - {.#None} - (at //.monad in (list syntax)))) - - _ - (at //.monad in (list syntax)))) - -(def .public (full_expansion syntax) - (-> Code (Meta (List Code))) - (case syntax - [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] - (do //.monad - [?macro (//.macro name)] - (case ?macro - {.#Some macro} - (do //.monad - [expansion ((as Macro' macro) args) - expansion' (monad.each //.monad full_expansion expansion)] - (in (list#conjoint expansion'))) - - {.#None} - (do //.monad - [parts' (monad.each //.monad full_expansion (list.partial (code.symbol name) args))] - (in (list (code.form (list#conjoint parts'))))))) - - [_ {.#Form {.#Item [harg targs]}}] - (do //.monad - [harg+ (full_expansion harg) - targs+ (monad.each //.monad full_expansion targs)] - (in (list (code.form (list#composite harg+ (list#conjoint (is (List (List Code)) targs+))))))) - - [_ {.#Variant members}] - (do //.monad - [members' (monad.each //.monad full_expansion members)] - (in (list (code.variant (list#conjoint members'))))) - - [_ {.#Tuple members}] - (do //.monad - [members' (monad.each //.monad full_expansion members)] - (in (list (code.tuple (list#conjoint members'))))) - - _ - (at //.monad in (list syntax)))) - -(def .public (symbol prefix) - (-> Text (Meta Code)) - (do //.monad - [id //.seed] - (in (|> id - (at nat.decimal encoded) - (all text#composite "__gensym__" prefix) - [""] code.symbol)))) - -(def (local ast) - (-> Code (Meta Text)) - (case ast - [_ {.#Symbol [_ name]}] - (at //.monad in name) - - _ - (//.failure (text#composite "Code is not a local symbol: " (code.format ast))))) - -(def .public wrong_syntax_error - (-> Symbol Text) - (|>> symbol#encoded - (text.prefix (text#composite "Wrong syntax for " text.\'')) - (text.suffix (text#composite text.\'' ".")))) - -(def .public with_symbols - (.macro (_ tokens) - (case tokens - (pattern (list [_ {.#Tuple symbols}] body)) - (do [! //.monad] - [symbol_names (monad.each ! ..local symbols) - .let [symbol_defs (list#conjoint (list#each (is (-> Text (List Code)) - (.function (_ name) (list (code.symbol ["" name]) (` (..symbol (, (code.text name))))))) - symbol_names))]] - (in (list (` ((,! do) (,! //.monad) - [(,* symbol_defs)] - (, body)))))) - - _ - (//.failure (..wrong_syntax_error (.symbol ..with_symbols)))))) - -(def .public (one_expansion token) - (-> Code (Meta Code)) - (do //.monad - [token+ (..expansion token)] - (case token+ - (pattern (list token')) - (in token') - - _ - (//.failure "Macro expanded to more than 1 element.")))) - -(with_template [ ] - [(def .public - (.macro (_ tokens) - (let [[module _] (.symbol .._) - [_ short] (.symbol ) - macro_name [module short]] - (case (is (Maybe [Bit Code]) - (case tokens - (pattern (list [_ {.#Text "omit"}] - token)) - {.#Some [#1 token]} - - (pattern (list token)) - {.#Some [#0 token]} - - _ - {.#None})) - {.#Some [omit? token]} - (do //.monad - [location //.location - output ( token) - .let [_ ("lux io log" (all text#composite (symbol#encoded macro_name) " " (location.format location))) - _ (list#each (|>> code.format "lux io log") - output) - _ ("lux io log" "")]] - (in (if omit? - (list) - output))) - - {.#None} - (//.failure (..wrong_syntax_error macro_name))))))] - - [log_single_expansion! ..single_expansion] - [log_expansion! ..expansion] - [log_full_expansion! ..full_expansion] - ) - -(def .public times - (.macro (_ tokens) - (case tokens - (pattern (list.partial [_ {.#Nat times}] terms)) - (loop (again [times times - before terms]) - (case times - 0 - (at //.monad in before) - - _ - (do [! //.monad] - [after (|> before - (monad.each ! ..single_expansion) - (at ! each list#conjoint))] - (again (-- times) after)))) - - _ - (//.failure (..wrong_syntax_error (.symbol ..times)))))) - -(def .public final - (.macro (_ it) - (let [! //.monad] - (|> it - (monad.each ! ..expansion) - (at ! each list#conjoint))))) - -(def .public function - (-> Macro Macro') - (|>> (as Macro'))) - -(def .public macro - (-> Macro' Macro) - (|>> (as Macro))) diff --git a/stdlib/source/library/lux/macro/context.lux b/stdlib/source/library/lux/macro/context.lux deleted file mode 100644 index 464d0cfea..000000000 --- a/stdlib/source/library/lux/macro/context.lux +++ /dev/null @@ -1,159 +0,0 @@ -(.require - [library - [lux (.except def global) - [abstract - [monad (.only do)]] - [control - ["?" parser] - ["[0]" exception (.only exception)] - ["[0]" maybe] - [function - [predicate (.only Predicate)]]] - [data - ["[0]" text (.use "[1]#[0]" equivalence monoid)] - [collection - ["[0]" list (.only) - ["[0]" property]]]] - ["[0]" meta (.only) - ["[0]" symbol (.use "[1]#[0]" codec)] - ["[0]" code (.only) - ["?[1]" \\parser]]]]] - ["[0]" // (.only) - [syntax (.only syntax)] - ["^" pattern]]) - -(type .public Stack - List) - -(exception .public (no_definition [it Symbol]) - (exception.report - "Definition" (symbol#encoded it))) - -(.def (global it) - (-> Symbol (Meta Any)) - (do meta.monad - [.let [[@ expected_name] it] - defs (meta.definitions @)] - (case (list.one (function (_ [actual_name [exported? type value]]) - (if (text#= expected_name actual_name) - {.#Some value} - {.#None})) - defs) - {.#Some it} - (in it) - - {.#None} - (meta.failure (exception.error ..no_definition [it]))))) - -(exception .public no_active_context) - -(.def (peek' _ context) - (All (_ a) (-> (Stack a) Symbol (Meta a))) - (do meta.monad - [stack (..global context)] - (case (|> stack - (as (Stack Any)) - list.head) - {.#Some top} - (in (as_expected top)) - - {.#None} - (meta.failure (exception.error ..no_active_context []))))) - -(.def .public peek - (syntax (_ [g!it (at ?.monad each code.symbol ?code.global)]) - (in (list (` ((,! ..peek') (, g!it) (.symbol (, g!it)))))))) - -(exception .public no_example) - -(.def (search' _ ? context) - (All (_ a) (-> (Stack a) (Predicate a) Symbol (Meta a))) - (do meta.monad - [stack (..global context)] - (case (|> stack - (as (Stack Any)) - (list.example (as (Predicate Any) ?))) - {.#Some it} - (in (as_expected it)) - - {.#None} - (meta.failure (exception.error ..no_example []))))) - -(.def .public search - (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) - g!? ?code.any]) - (in (list (` ((,! ..search') (, g!context) (, g!?) (.symbol (, g!context)))))))) - -(.def (alter on_definition [@ context]) - (-> (-> Definition Definition) Symbol (Meta Any)) - (function (_ lux) - (let [on_global (is (-> Global Global) - (function (_ it) - (case it - {.#Definition it} - {.#Definition (on_definition it)} - - _ - it))) - on_globals (is (-> (property.List Global) (property.List Global)) - (property.revised context on_global)) - on_module (is (-> Module Module) - (revised .#definitions on_globals))] - {.#Right [(revised .#modules (property.revised @ on_module) lux) - []]}))) - -(.def (push' _ top) - (All (_ a) (-> (Stack a) a Symbol (Meta Any))) - (alter (function (_ [exported? type stack]) - (|> stack - (as (Stack Any)) - {.#Item top} - (is (Stack Any)) - [exported? type])))) - -(.def .public push - (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) - g!it ?code.any]) - (in (list (` ((,! ..push') (, g!context) (, g!it) (.symbol (, g!context)))))))) - -(.def pop' - (-> Symbol (Meta Any)) - (alter (function (_ [exported? type value]) - [exported? type (let [value (as (Stack Any) value)] - (maybe.else value (list.tail value)))]))) - -(.def .public pop - (syntax (_ [expression? ?code.bit - context ?code.global]) - (do meta.monad - [_ (..pop' context)] - (in (if expression? - (list (' [])) - (list)))))) - -(.def .public def - (syntax (_ [.let [! ?.monad - ?local (at ! each code.local ?code.local)] - [$ g!expression g!declaration] (?code.tuple (all ?.and ?code.local ?local ?local)) - context_type ?code.any]) - (do [! meta.monad] - [@ meta.current_module_name - .let [g!context (code.symbol [@ $])]] - (//.with_symbols [g!it g!body g!_] - (in (list (` (.def (, (code.local $)) - (..Stack (, context_type)) - (list))) - (` (.def ((, g!expression) (, g!it) (, g!body)) - (-> (, context_type) Code (Meta Code)) - ((,! do) (,! meta.monad) - [(, g!_) ((,! ..push) (, g!context) (, g!it))] - ((,' in) (` (let [((,' ,') (, g!body)) ((,' ,) (, g!body)) - ((,' ,') (, g!_)) ((,! ..pop) #1 (, g!context))] - ((,' ,') (, g!body)))))))) - (` (.def ((, g!declaration) (, g!it) (, g!body)) - (-> (, context_type) Code (Meta (List Code))) - ((,! do) (,! meta.monad) - [(, g!_) ((,! ..push) (, g!context) (, g!it))] - ((,' in) (list (, g!body) - (` ((,! ..pop) #0 (, g!context)))))))) - )))))) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux deleted file mode 100644 index 9b2ec3156..000000000 --- a/stdlib/source/library/lux/macro/local.lux +++ /dev/null @@ -1,144 +0,0 @@ -(.require - [library - [lux (.except with let) - [abstract - ["[0]" monad (.only do)]] - [control - ["<>" parser] - ["[0]" try (.only Try)] - ["[0]" exception (.only exception)]] - [data - ["[0]" product] - ["[0]" text] - [collection - ["[0]" list (.use "[1]#[0]" functor) - ["[0]" property]]]] - ["[0]" meta (.only) - ["[0]" code (.only) - ["<[1]>" \\parser]]]]] - ["[0]" // (.only) - [syntax (.only syntax)]]) - -(exception .public (unknown_module [module Text]) - (exception.report - "Module" (text.format module))) - -(with_template [] - [(exception .public ( [module Text - definition Text]) - (exception.report - "Module" (text.format module) - "Definition" (text.format definition)))] - - [cannot_shadow_definition] - [unknown_definition] - ) - -(def (with_module name body) - (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) - (function (_ compiler) - (case (|> compiler (the .#modules) (property.value name)) - {.#Some module} - (case (body module) - {try.#Success [module' output]} - {try.#Success [(revised .#modules (property.has name module') compiler) - output]} - - {try.#Failure error} - {try.#Failure error}) - - {.#None} - (exception.except ..unknown_module [name])))) - -(def (push_one [name macro]) - (-> [Symbol Macro] (Meta Any)) - (do meta.monad - [[module_name definition_name] (meta.normal name) - .let [definition (is Global {.#Definition [false .Macro macro]}) - add_macro! (is (-> (property.List Global) (property.List Global)) - (property.has definition_name definition))]] - (..with_module module_name - (function (_ module) - (case (|> module (the .#definitions) (property.value definition_name)) - {.#None} - {try.#Success [(revised .#definitions add_macro! module) - []]} - - {.#Some _} - (exception.except ..cannot_shadow_definition [module_name definition_name])))))) - -(def (pop_one name) - (-> Symbol (Meta Any)) - (do meta.monad - [[module_name definition_name] (meta.normal name) - .let [lacks_macro! (is (-> (property.List Global) (property.List Global)) - (property.lacks definition_name))]] - (..with_module module_name - (function (_ module) - (case (|> module (the .#definitions) (property.value definition_name)) - {.#Some _} - {try.#Success [(revised .#definitions lacks_macro! module) - []]} - - {.#None} - (exception.except ..unknown_definition [module_name definition_name])))))) - -(def (pop_all macros self) - (-> (List Symbol) Symbol Macro) - ("lux macro" - (function (_ _) - (do [! meta.monad] - [_ (monad.each ! ..pop_one macros) - _ (..pop_one self) - compiler meta.compiler_state] - (in (case (the .#expected compiler) - {.#Some _} - (list (' [])) - - {.#None} - (list))))))) - -(def .public (push macros) - (-> (List [Symbol Macro]) (Meta Code)) - (do meta.monad - [_ (monad.each meta.monad ..push_one macros) - seed meta.seed - g!pop (//.symbol "pop") - _ (.let [g!pop (is Symbol - ["" (code.format g!pop)])] - (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))] - (in (` ((, g!pop)))))) - -(def .public (with macros expression? body) - (-> (List [Symbol Macro]) Bit Code (Meta (List Code))) - (do [! meta.monad] - [g!pop (..push macros)] - (.if expression? - (//.with_symbols [g!body] - (in (list (` (.let [(, g!body) (, body)] - (exec - (, g!pop) - (, g!body))))))) - (in (list body - g!pop))))) - -(def .public let - (syntax (_ [locals (.tuple (<>.some (<>.and .local .any))) - body .any]) - (do [! meta.monad] - [here_name meta.current_module_name - locals (monad.each ! (function (_ [name value]) - (|> value - (meta.eval .Macro) - (at ! each (|>> (as .Macro) - [[here_name name]])))) - locals) - expression? (is (Meta Bit) - (function (_ lux) - {try.#Success [lux (case (the .#expected lux) - {.#None} - false - - {.#Some _} - true)]}))] - (..with locals expression? body)))) diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux deleted file mode 100644 index affa8273a..000000000 --- a/stdlib/source/library/lux/macro/pattern.lux +++ /dev/null @@ -1,256 +0,0 @@ -(.require - [library - [lux (.except or let with_template |> `)]]) - -(def partial_list - (`` ("lux in-module" (,, (static .prelude)) .partial_list))) - -(def locally - (macro (_ tokens lux) - (.let [[prelude _] (symbol ._)] - (case tokens - (pattern (list [@ {.#Symbol ["" name]}])) - {.#Right [lux (list (.` ("lux in-module" (, [@ {.#Text prelude}]) - (, [@ {.#Symbol [prelude name]}]))))]} - - _ - {.#Left ""})))) - -(.with_template [] - [(def (..locally ))] - - [list#size] - [list#composite] - [list#each] - [list#conjoint] - [every?] - - [maybe#monad] - - [function#composite] - - [failure] - [meta#in] - - [do] - [monad#each] - - [Replacement_Environment] - [realized_template] - [replacement_environment] - - [symbol_short] - [tuple_list] - - [meta#monad] - [text$] - [generated_symbol] - [type_definition] - [record_slots] - [text#composite] - [type#encoded] - [module_alias] - [symbol$] - [tuple$] - [monad#mix] - [zipped_2] - - [multi_level_case^] - [multi_level_case$] - [type_code] - [expected_type] - - [wrong_syntax_error] - [local$] - - [list#reversed] - [untemplated_list] - [bit$] - [nat$] - [int$] - [rev$] - [frac$] - ) - -(def .public or - (macro (_ tokens) - (case tokens - (pattern (partial_list [_ {.#Form patterns}] body branches)) - (case patterns - {.#End} - (failure (..wrong_syntax_error (symbol ..or))) - - _ - (.let [pairs (.|> patterns - (list#each (function (_ pattern) (list pattern body))) - list#conjoint)] - (meta#in (list#composite pairs branches)))) - _ - (failure (..wrong_syntax_error (symbol ..or)))))) - -(def .public with_template - (macro (_ tokens) - (case tokens - (pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}] - [_ {.#Tuple templates}])}] - [_ {.#Form data}] - branches)) - (case (is (Maybe (List Code)) - (do maybe#monad - [bindings' (monad#each maybe#monad symbol_short bindings) - data' (monad#each maybe#monad tuple_list data)] - (.let [num_bindings (list#size bindings')] - (if (every? (|>> ("lux i64 =" num_bindings)) - (list#each list#size data')) - (.let [apply (is (-> Replacement_Environment (List Code)) - (function (_ env) (list#each (realized_template env) templates)))] - (.|> data' - (list#each (function#composite apply (replacement_environment bindings'))) - list#conjoint - in)) - {.#None})))) - {.#Some output} - (meta#in (list#composite output branches)) - - {.#None} - (failure (..wrong_syntax_error (symbol ..with_template)))) - - _ - (failure (..wrong_syntax_error (symbol ..with_template)))))) - -(def .public multi - (macro (_ tokens) - (case tokens - (pattern (partial_list [_meta {.#Form levels}] body next_branches)) - (do meta#monad - [mlc (multi_level_case^ levels) - .let [initial_bind? (case mlc - [[_ {.#Symbol _}] _] - #1 - - _ - #0)] - expected ..expected_type - g!temp (..generated_symbol "temp")] - (in (list g!temp - (.` ({{.#Some (, g!temp)} - (, g!temp) - - {.#None} - (.case (, g!temp) - (,* next_branches))} - ("lux type check" {.#Apply (, (type_code expected)) Maybe} - (.case (, g!temp) - (,* (multi_level_case$ g!temp [mlc body])) - - (,* (if initial_bind? - (list) - (list g!temp (.` {.#None}))))))))))) - - _ - (failure (..wrong_syntax_error (symbol ..multi)))))) - -(def .public let - (macro (_ tokens) - (case tokens - (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] pattern)}] body branches)) - (.let [g!whole (local$ name)] - (meta#in (partial_list g!whole - (.` (case (, g!whole) (, pattern) (, body))) - branches))) - - _ - (failure (..wrong_syntax_error (symbol ..let)))))) - -(def .public |> - (macro (_ tokens) - (case tokens - (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] [_ {.#Tuple steps}])}] body branches)) - (.let [g!name (local$ name)] - (meta#in (partial_list g!name - (.` (.let [(, g!name) (.|> (, g!name) (,* steps))] - (, body))) - branches))) - - _ - (failure (..wrong_syntax_error (symbol ..|>)))))) - -(def (name$ [module name]) - (-> Symbol Code) - (.` [(, (text$ module)) (, (text$ name))])) - -(def (untemplated_partial_list last inits) - (-> Code (List Code) Code) - (case inits - {.#End} - last - - {.#Item [init inits']} - (.` {.#Item (, init) (, (untemplated_partial_list last inits'))}))) - -(.with_template [ ] - [(def ( g!meta untemplated_pattern elems) - (-> Code (-> Code (Meta Code)) - (-> (List Code) (Meta Code))) - (case (list#reversed elems) - {.#Item [_ {.#Form {.#Item [[_ {.#Symbol ["" ",*"]}] {.#Item [spliced {.#End}]}]}}] - inits} - (do meta#monad - [=inits (monad#each meta#monad untemplated_pattern (list#reversed inits))] - (in (.` [(, g!meta) { (, (untemplated_partial_list spliced =inits))}]))) - - _ - (do meta#monad - [=elems (monad#each meta#monad untemplated_pattern elems)] - (in (.` [(, g!meta) { (, (untemplated_list =elems))}])))))] - - [.#Form untemplated_form] - [.#Variant untemplated_variant] - [.#Tuple untemplated_tuple] - ) - -(def (untemplated_pattern pattern) - (-> Code (Meta Code)) - (do meta#monad - [g!meta (..generated_symbol "g!meta")] - (case pattern - (..with_template [ ] - [[_ { value}] - (in (.` [(, g!meta) { (, ( value))}]))]) - ([.#Bit bit$] - [.#Nat nat$] - [.#Int int$] - [.#Rev rev$] - [.#Frac frac$] - [.#Text text$] - [.#Symbol name$]) - - [_ {.#Form {.#Item [[_ {.#Symbol ["" ","]}] {.#Item [unquoted {.#End}]}]}}] - (in unquoted) - - [_ {.#Form {.#Item [[_ {.#Symbol ["" ",*"]}] {.#Item [spliced {.#End}]}]}}] - (failure "Cannot use (,*) inside of `code` unless it is the last element in a form or a tuple.") - - (..with_template [ ] - [[_ { elems}] - ( g!meta untemplated_pattern elems)]) - ([.#Form ..untemplated_form] - [.#Variant ..untemplated_variant] - [.#Tuple ..untemplated_tuple]) - ))) - -(def .public ` - (macro (_ tokens) - (case tokens - (pattern (partial_list [_meta {.#Form (list template)}] body branches)) - (do meta#monad - [pattern (untemplated_pattern template)] - (in (partial_list pattern body branches))) - - (pattern (list template)) - (do meta#monad - [pattern (untemplated_pattern template)] - (in (list pattern))) - - _ - (failure (..wrong_syntax_error (symbol ..`)))))) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux deleted file mode 100644 index 5321db403..000000000 --- a/stdlib/source/library/lux/macro/syntax.lux +++ /dev/null @@ -1,99 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - ["[0]" monad (.only do)]] - [control - ["<>" parser] - ["[0]" try]] - [data - ["[0]" text (.use "[1]#[0]" monoid)] - [collection - ["[0]" list]]] - ["[0]" meta (.only) - ["[0]" code (.only) - ["" \\parser (.only Parser)]]]]] - ["[0]" // (.only with_symbols)]) - -(def (self_documenting binding parser) - (All (_ a) (-> Code (Parser a) (Parser a))) - (function (_ tokens) - (case (parser tokens) - {try.#Failure error} - {try.#Failure (all text#composite - "Failed to parse: " (code.format binding) text.new_line - error)} - - success - success))) - -(def (un_paired pairs) - (All (_ a) (-> (List [a a]) (List a))) - (case pairs - {.#Item [x y] pairs'} - (list.partial x y (un_paired pairs')) - - {.#End} - {.#End})) - -(def syntaxP - (Parser [[Text (Maybe Text) (List Code)] Code]) - (all <>.and - (.form (all <>.and - .local - (<>.maybe .local) - (.tuple (<>.some .any)))) - .any)) - -(def .public syntax - (macro (_ tokens) - (case (.result ..syntaxP tokens) - {try.#Success [[name g!state args] body]} - (with_symbols [g!tokens g!body g!error] - (do [! meta.monad] - [vars+parsers (case (list.pairs args) - {.#Some args} - (monad.each ! - (is (-> [Code Code] (Meta [Code Code])) - (function (_ [var parser]) - (with_expansions [ (in [var - (` ((,! ..self_documenting) (' (, var)) - (, parser)))])] - (case var - [_ {.#Symbol ["" _]}] - - - [_ {.#Symbol _}] - (in [var parser]) - - _ - )))) - args) - - _ - (meta.failure "Syntax pattern expects pairs of bindings and code-parsers.")) - g!state (case g!state - {.#Some g!state} - (in (code.local g!state)) - - {.#None} - (//.symbol "g!state")) - this_module meta.current_module_name - .let [g!name (code.symbol ["" name])]] - (in (list (` (.macro ((, g!name) (, g!tokens) (, g!state)) - (.case ((,! .result) - (is ((,! .Parser) (Meta (List Code))) - ((,! do) (,! <>.monad) - [(,* (..un_paired vars+parsers))] - (.at (,! <>.monad) (,' in) - (is (Meta (List Code)) - (, body))))) - (, g!tokens)) - {try.#Success (, g!body)} - ((, g!body) (, g!state)) - - {try.#Failure (, g!error)} - {try.#Failure ((,! text.interposed) (,! text.new_line) (list "Invalid syntax:" (, g!error)))}))))))) - - {try.#Failure error} - (meta.failure (//.wrong_syntax_error (symbol ..syntax)))))) diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux deleted file mode 100644 index 21a8aff54..000000000 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ /dev/null @@ -1,41 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)] - [monad (.only do)]] - [control - ["<>" parser]] - [data - ["[0]" product]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) - -(def extension - "lux check") - -(type .public Check - (Record - [#type Code - #value Code])) - -(def .public equivalence - (Equivalence Check) - (all product.equivalence - code.equivalence - code.equivalence - )) - -(def .public (format (open "_[0]")) - (-> Check Code) - (` ((, (code.text ..extension)) - (, _#type) - (, _#value)))) - -(def .public parser - (Parser Check) - (<| .form - (<>.after (.this_text ..extension)) - (<>.and .any - .any))) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux deleted file mode 100644 index 1f4a9cccd..000000000 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ /dev/null @@ -1,44 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)]] - [control - ["<>" parser (.use "[1]#[0]" monad)]] - [data - ["[0]" product] - ["[0]" text] - [collection - ["[0]" list (.use "[1]#[0]" functor)]]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) - -(type .public Declaration - (Record - [#name Text - #arguments (List Text)])) - -(def .public equivalence - (Equivalence Declaration) - (all product.equivalence - text.equivalence - (list.equivalence text.equivalence) - )) - -(def .public parser - (Parser Declaration) - (<>.either (<>.and .local - (<>#in (list))) - (.form (<>.and .local - (<>.some .local))))) - -(def .public (format value) - (-> Declaration Code) - (let [g!name (code.local (the #name value))] - (case (the #arguments value) - {.#End} - g!name - - arguments - (` ((, g!name) (,* (list#each code.local arguments))))))) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux deleted file mode 100644 index b9627f0a2..000000000 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ /dev/null @@ -1,97 +0,0 @@ -(.require - [library - [lux (.except Definition) - ["[0]" macro] - [abstract - [equivalence (.only Equivalence)] - [monad (.only do)]] - [control - ["<>" parser] - ["[0]" exception (.only exception)]] - [data - ["[0]" sum] - ["[0]" product] - ["[0]" bit] - ["[0]" text (.only) - ["%" \\format]] - [collection - ["[0]" list]]] - ["[0]" meta (.only) - ["[0]" location] - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] - ["[0]" // (.only) - ["[1][0]" check (.only Check)]]) - -(type .public Definition - (Record - [#name Text - #value (Either Check - Code) - #export? Bit])) - -(def .public equivalence - (Equivalence Definition) - (all product.equivalence - text.equivalence - (all sum.equivalence - //check.equivalence - code.equivalence - ) - bit.equivalence - )) - -(def extension - "lux def") - -(def dummy - Code - (` [.#module (, (code.text (the .#module location.dummy))) - .#line (, (code.nat (the .#line location.dummy))) - .#column (, (code.nat (the .#column location.dummy)))])) - -(def .public (format (open "_[0]")) - (-> Definition Code) - (` ((, (code.text ..extension)) - (, (code.local _#name)) - (, (case _#value - {.#Left check} - (//check.format check) - - {.#Right value} - value)) - (, (code.bit _#export?))))) - -(def .public (parser compiler) - (-> Lux (Parser Definition)) - (do [! <>.monad] - [raw .any - me_raw (|> raw - macro.full_expansion - (meta.result compiler) - <>.lifted)] - (<| (.locally me_raw) - .form - (<>.after (.this_text ..extension)) - (all <>.and - .local - (<>.or //check.parser - .any) - .bit - )))) - -(exception .public (lacks_type [definition Definition]) - (exception.report - "Definition" (%.code (..format definition)))) - -(def .public (typed compiler) - (-> Lux (Parser Definition)) - (do <>.monad - [definition (..parser compiler) - _ (case (the #value definition) - {.#Left _} - (in []) - - {.#Right _} - (<>.lifted (exception.except ..lacks_type [definition])))] - (in definition))) diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux deleted file mode 100644 index 81400ed1f..000000000 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ /dev/null @@ -1,37 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)]] - [control - ["<>" parser]] - [macro - ["^" pattern]] - [meta - ["[0]" code - ["<[1]>" \\parser (.only Parser)]]]]]) - -(def .public default_policy - Code - (` .private)) - -(def policy - (Parser Code) - (do [! <>.monad] - [candidate .next] - (case candidate - [_ {.#Symbol ["" _]}] - (in default_policy) - - (^.or [_ {.#Bit _}] - [_ {.#Symbol _}]) - (do ! - [_ .any] - (in candidate)) - - _ - (in default_policy)))) - -(def .public parser - (All (_ a) (-> (Parser a) (Parser [Code a]))) - (<>.and ..policy)) diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux deleted file mode 100644 index 4461c7df9..000000000 --- a/stdlib/source/library/lux/macro/syntax/input.lux +++ /dev/null @@ -1,43 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)]] - [control - ["<>" parser]] - [data - ["[0]" product] - [collection - ["[0]" list (.use "[1]#[0]" monad)]]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) - -(type .public Input - (Record - [#binding Code - #type Code])) - -(def .public equivalence - (Equivalence Input) - (all product.equivalence - code.equivalence - code.equivalence - )) - -(def .public format - (-> (List Input) Code) - (|>> (list#each (function (_ value) - (list (the #binding value) - (the #type value)))) - list#conjoint - code.tuple)) - -(def .public parser - (Parser (List Input)) - (<| .tuple - <>.some - (all <>.and - .any - .any - ))) diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux deleted file mode 100644 index 363f85fc0..000000000 --- a/stdlib/source/library/lux/macro/syntax/type/variable.lux +++ /dev/null @@ -1,25 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [equivalence (.only Equivalence)]] - [data - ["[0]" text]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) - -(type .public Variable - Text) - -(def .public equivalence - (Equivalence Variable) - text.equivalence) - -(def .public format - (-> Variable Code) - code.local) - -(def .public parser - (Parser Variable) - .local) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux deleted file mode 100644 index 7b71d005e..000000000 --- a/stdlib/source/library/lux/macro/template.lux +++ /dev/null @@ -1,185 +0,0 @@ -(.require - [library - [lux (.except let local symbol macro) - [abstract - ["[0]" monad (.only do)]] - [control - ["<>" parser (.use "[1]#[0]" functor)] - ["[0]" try (.only Try)] - ["[0]" exception (.only exception)]] - [data - ["[0]" bit (.use "[1]#[0]" codec)] - ["[0]" text] - [collection - ["[0]" list (.use "[1]#[0]" monad)] - ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]] - [math - [number - ["[0]" nat (.use "[1]#[0]" decimal)] - ["[0]" int (.use "[1]#[0]" decimal)] - ["[0]" rev (.use "[1]#[0]" decimal)] - ["[0]" frac (.use "[1]#[0]" decimal)]]] - ["[0]" meta (.only) - ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] - ["[0]" // (.only) - [syntax (.only syntax)] - ["[0]" local]]) - -(def .public spliced - (syntax (_ [parts (.tuple (<>.some .any))]) - (in parts))) - -(def .public amount - (syntax (_ [parts (.tuple (<>.some .any))]) - (in (list (code.nat (list.size parts)))))) - -(def .public with_locals - (syntax (_ [locals (.tuple (<>.some .local)) - body .any]) - (do [! meta.monad] - [g!locals (|> locals - (list#each //.symbol) - (monad.all !))] - (in (list (` (.with_expansions [(,* (|> (list.zipped_2 locals g!locals) - (list#each (function (_ [name symbol]) - (list (code.local name) symbol))) - list#conjoint))] - (, body)))))))) - -(def (symbol_side module_side? parser) - (-> Bit (Parser Symbol) (Parser Text)) - (do <>.monad - [[module short] parser] - (in (if module_side? - (case module - "" short - _ module) - short)))) - -(def (snippet module_side?) - (-> Bit (Parser Text)) - (.let [full_symbol (..symbol_side module_side? .symbol)] - (all <>.either - .text - (if module_side? - full_symbol - (<>.either .local - full_symbol)) - (<>#each bit#encoded .bit) - (<>#each nat#encoded .nat) - (<>#each int#encoded .int) - (<>#each rev#encoded .rev) - (<>#each frac#encoded .frac) - ))) - -(def (part module_side?) - (-> Bit (Parser (List Text))) - (.tuple (<>.many (..snippet module_side?)))) - -(def .public text - (syntax (_ [simple (..part false)]) - (in (list (|> simple (text.interposed "") code.text))))) - -(with_template [ ] - [(def .public - (syntax (_ [name (<>.or (<>.and (..part true) (..part false)) - (..part false))]) - (case name - {.#Left [simple complex]} - (in (list ( [(text.interposed "" simple) - (text.interposed "" complex)]))) - - {.#Right simple} - (in (list (|> simple (text.interposed "") ))))))] - - [symbol code.local code.symbol] - ) - -(type Environment - (Dictionary Text Code)) - -(def (applied env template) - (-> Environment Code Code) - (case template - [_ {.#Symbol "" name}] - (case (dictionary.value name env) - {.#Some substitute} - substitute - - {.#None} - template) - - (^.with_template [] - [[meta { elems}] - [meta { (list#each (applied env) elems)}]]) - ([.#Form] - [.#Variant] - [.#Tuple]) - - _ - template)) - -(type Local - (Record - [#name Text - #parameters (List Text) - #template (List Code)])) - -(exception .public (irregular_arguments [expected Nat - actual Nat]) - (exception.report - "Expected" (at nat.decimal encoded expected) - "Actual" (at nat.decimal encoded actual))) - -(def (macro (open "_[0]")) - (-> Local Macro) - ("lux macro" - (function (_ inputs compiler) - (.let [parameters_amount (list.size _#parameters) - inputs_amount (list.size inputs)] - (if (nat.= parameters_amount inputs_amount) - (.let [environment (is Environment - (|> (list.zipped_2 _#parameters inputs) - (dictionary.of_list text.hash)))] - {.#Right [compiler (list#each (..applied environment) _#template)]}) - (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) - -(def local - (Parser Local) - (do <>.monad - [[name parameters] (.form (<>.and .local - (<>.many .local))) - template (.tuple (<>.some .any))] - (in [#name name - #parameters parameters - #template template]))) - -... TODO: Get rid of this (and any local definitions it depends on) once the bootstrapping compiler is gone. -(def .public let - (syntax (_ [locals (.tuple (<>.some ..local)) - body .any]) - (do meta.monad - [here_name meta.current_module_name - expression? (is (Meta Bit) - (function (_ lux) - {try.#Success [lux (case (the .#expected lux) - {.#None} - false - - {.#Some _} - true)]})) - g!pop (local.push (list#each (function (_ local) - [[here_name (the #name local)] - (..macro local)]) - locals))] - (if expression? - (//.with_symbols [g!body] - (in (list (` (.let [(, g!body) (, body)] - (exec - (, g!pop) - (, g!body))))))) - (in (list body - g!pop)))))) diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 49a572887..2bda65168 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -15,14 +15,14 @@ ["%" \\format]] [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [meta - [type - ["[0]" check]] ["[0]" code - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + ["[0]" check]]] [tool [compiler ["[0]" phase (.use "[1]#[0]" monad)] diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index 5c4603e99..6716f43b2 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -9,15 +9,15 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - [syntax (.only syntax)]] [math [number ["n" nat] ["i" int]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)]]]]]) (type Infix (Rec Infix diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index b6f9afdc7..16f184bc5 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -19,10 +19,10 @@ [number ["i" int (.use "[1]#[0]" decimal)]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [type + [primitive (.except)]]]]] ["[0]" // ["[1]" modulus (.only Modulus)]]) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 57e313bcf..fea4f576f 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -6,16 +6,16 @@ [control ["[0]" try (.only Try)] ["[0]" exception (.only exception)]] - [macro - [syntax (.only syntax)]] [math [number ["i" int]]] ["[0]" meta (.only) - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]] + [type + [primitive (.except)]]]]]) (exception .public zero_cannot_be_a_modulus) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 3cb0e401d..ef699d5d5 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -7,8 +7,9 @@ ["[0]" try (.only Try)]] [data ["[0]" text]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" / ["[1][0]" nat] ["[1][0]" int] diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 65e28513d..8392c9a57 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -9,15 +9,15 @@ [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - [syntax (.only syntax)]] [math [number ["f" frac] ["[0]" int]]] [meta ["[0]" code - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]]) (type .public Complex (Record diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index a91d24bd8..f4048ebc8 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -16,8 +16,9 @@ [predicate (.only Predicate)]]] [data ["[0]" text]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // ["[1][0]" i64] ["[1][0]" nat] diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 29fc9d13e..33c82109e 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -16,8 +16,9 @@ [predicate (.only Predicate)]]] [data [text (.only Char)]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // ["[1][0]" nat] ["[1][0]" i64]]) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 51d2c68b8..5f63ffb78 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -13,8 +13,9 @@ ["[0]" function] ["[0]" maybe] ["[0]" try (.only Try)]] - [macro - ["^" pattern]]]]) + [meta + [macro + ["^" pattern]]]]]) (with_template [ ] [(def .public ( parameter subject) diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 5c11f118c..e521bddf9 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -15,11 +15,11 @@ [data ["[0]" product] ["[0]" text (.use "[1]#[0]" monoid)]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + [macro + [syntax (.only syntax)]]]]] [// ["n" nat (.use "[1]#[0]" decimal)]]) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 7ebf577d7..ece9576f8 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -28,15 +28,15 @@ ["r" ratio] ["c" complex] ["[0]" i64]]] + [meta + [type + [refinement (.only Refiner Refined)]]] ["[0]" time (.only Time) ["[0]" instant (.only Instant)] ["[0]" date (.only Date)] ["[0]" duration (.only Duration)] ["[0]" month (.only Month)] - ["[0]" day (.only Day)]] - [meta - [type - [refinement (.only Refiner Refined)]]]]]) + ["[0]" day (.only Day)]]]]) (type .public PRNG (Rec PRNG diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 63375b626..611028e8e 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -14,17 +14,16 @@ [collection ["[0]" list (.use "[1]#[0]" monoid monad) ["[0]" property]]]] - [macro - ["^" pattern]] [math [number ["n" nat] - ["i" int]]] - [meta - ["[0]" symbol (.use "[1]#[0]" codec equivalence)] - ["[0]" code]]]] + ["i" int]]]]] [/ - ["[0]" location]]) + ["[0]" location] + ["[0]" symbol (.use "[1]#[0]" codec equivalence)] + ["[0]" code] + [macro + ["^" pattern]]]) ... (.type (Meta a) ... (-> Lux (Try [Lux a]))) diff --git a/stdlib/source/library/lux/meta/code.lux b/stdlib/source/library/lux/meta/code.lux index dc182b124..c65f613c5 100644 --- a/stdlib/source/library/lux/meta/code.lux +++ b/stdlib/source/library/lux/meta/code.lux @@ -9,8 +9,6 @@ ["[0]" text (.use "[1]#[0]" monoid equivalence)] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math [number ["[0]" nat] @@ -19,7 +17,9 @@ ["[0]" frac]]] [meta ["[0]" location] - ["[0]" symbol]]]]) + ["[0]" symbol] + [macro + ["^" pattern]]]]]) ... (type (Code' w) ... {.#Bit Bit} diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux index 3ed5e3e6c..45ca34758 100644 --- a/stdlib/source/library/lux/meta/configuration.lux +++ b/stdlib/source/library/lux/meta/configuration.lux @@ -16,13 +16,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix) ["/" property]]]] - [macro - [syntax (.only syntax)]] [math [number (.only hex)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]]) (type .public Configuration (/.List Text)) diff --git a/stdlib/source/library/lux/meta/macro.lux b/stdlib/source/library/lux/meta/macro.lux new file mode 100644 index 000000000..86e9fe57d --- /dev/null +++ b/stdlib/source/library/lux/meta/macro.lux @@ -0,0 +1,213 @@ +(.require + [library + [lux (.except local symbol function macro) + [abstract + ["[0]" monad (.only do)]] + [data + ["[0]" text (.use "[1]#[0]" monoid)] + [collection + ["[0]" list (.use "[1]#[0]" monoid monad)]]] + [math + [number + ["[0]" nat] + ["[0]" int]]]]] + ["[0]" // (.only) + ["[0]" code] + ["[0]" location] + ["[0]" symbol (.use "[1]#[0]" codec)]]) + +(def .public (single_expansion syntax) + (-> Code (Meta (List Code))) + (case syntax + [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] + (do //.monad + [?macro (//.macro name)] + (case ?macro + {.#Some macro} + ((as Macro' macro) args) + + {.#None} + (at //.monad in (list syntax)))) + + _ + (at //.monad in (list syntax)))) + +(def .public (expansion syntax) + (-> Code (Meta (List Code))) + (case syntax + [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] + (do //.monad + [?macro (//.macro name)] + (case ?macro + {.#Some macro} + (do [! //.monad] + [top_level_expansion ((as Macro' macro) args)] + (|> top_level_expansion + (monad.each //.monad expansion) + (at ! each list#conjoint))) + + {.#None} + (at //.monad in (list syntax)))) + + _ + (at //.monad in (list syntax)))) + +(def .public (full_expansion syntax) + (-> Code (Meta (List Code))) + (case syntax + [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] + (do //.monad + [?macro (//.macro name)] + (case ?macro + {.#Some macro} + (do //.monad + [expansion ((as Macro' macro) args) + expansion' (monad.each //.monad full_expansion expansion)] + (in (list#conjoint expansion'))) + + {.#None} + (do //.monad + [parts' (monad.each //.monad full_expansion (list.partial (code.symbol name) args))] + (in (list (code.form (list#conjoint parts'))))))) + + [_ {.#Form {.#Item [harg targs]}}] + (do //.monad + [harg+ (full_expansion harg) + targs+ (monad.each //.monad full_expansion targs)] + (in (list (code.form (list#composite harg+ (list#conjoint (is (List (List Code)) targs+))))))) + + [_ {.#Variant members}] + (do //.monad + [members' (monad.each //.monad full_expansion members)] + (in (list (code.variant (list#conjoint members'))))) + + [_ {.#Tuple members}] + (do //.monad + [members' (monad.each //.monad full_expansion members)] + (in (list (code.tuple (list#conjoint members'))))) + + _ + (at //.monad in (list syntax)))) + +(def .public (symbol prefix) + (-> Text (Meta Code)) + (do //.monad + [id //.seed] + (in (|> id + (at nat.decimal encoded) + (all text#composite "__gensym__" prefix) + [""] code.symbol)))) + +(def (local ast) + (-> Code (Meta Text)) + (case ast + [_ {.#Symbol [_ name]}] + (at //.monad in name) + + _ + (//.failure (text#composite "Code is not a local symbol: " (code.format ast))))) + +(def .public wrong_syntax_error + (-> Symbol Text) + (|>> symbol#encoded + (text.prefix (text#composite "Wrong syntax for " text.\'')) + (text.suffix (text#composite text.\'' ".")))) + +(def .public with_symbols + (.macro (_ tokens) + (case tokens + (pattern (list [_ {.#Tuple symbols}] body)) + (do [! //.monad] + [symbol_names (monad.each ! ..local symbols) + .let [symbol_defs (list#conjoint (list#each (is (-> Text (List Code)) + (.function (_ name) (list (code.symbol ["" name]) (` (..symbol (, (code.text name))))))) + symbol_names))]] + (in (list (` ((,! do) (,! //.monad) + [(,* symbol_defs)] + (, body)))))) + + _ + (//.failure (..wrong_syntax_error (.symbol ..with_symbols)))))) + +(def .public (one_expansion token) + (-> Code (Meta Code)) + (do //.monad + [token+ (..expansion token)] + (case token+ + (pattern (list token')) + (in token') + + _ + (//.failure "Macro expanded to more than 1 element.")))) + +(with_template [ ] + [(def .public + (.macro (_ tokens) + (let [[module _] (.symbol .._) + [_ short] (.symbol ) + macro_name [module short]] + (case (is (Maybe [Bit Code]) + (case tokens + (pattern (list [_ {.#Text "omit"}] + token)) + {.#Some [#1 token]} + + (pattern (list token)) + {.#Some [#0 token]} + + _ + {.#None})) + {.#Some [omit? token]} + (do //.monad + [location //.location + output ( token) + .let [_ ("lux io log" (all text#composite (symbol#encoded macro_name) " " (location.format location))) + _ (list#each (|>> code.format "lux io log") + output) + _ ("lux io log" "")]] + (in (if omit? + (list) + output))) + + {.#None} + (//.failure (..wrong_syntax_error macro_name))))))] + + [log_single_expansion! ..single_expansion] + [log_expansion! ..expansion] + [log_full_expansion! ..full_expansion] + ) + +(def .public times + (.macro (_ tokens) + (case tokens + (pattern (list.partial [_ {.#Nat times}] terms)) + (loop (again [times times + before terms]) + (case times + 0 + (at //.monad in before) + + _ + (do [! //.monad] + [after (|> before + (monad.each ! ..single_expansion) + (at ! each list#conjoint))] + (again (-- times) after)))) + + _ + (//.failure (..wrong_syntax_error (.symbol ..times)))))) + +(def .public final + (.macro (_ it) + (let [! //.monad] + (|> it + (monad.each ! ..expansion) + (at ! each list#conjoint))))) + +(def .public function + (-> Macro Macro') + (|>> (as Macro'))) + +(def .public macro + (-> Macro' Macro) + (|>> (as Macro))) diff --git a/stdlib/source/library/lux/meta/macro/context.lux b/stdlib/source/library/lux/meta/macro/context.lux new file mode 100644 index 000000000..464d0cfea --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/context.lux @@ -0,0 +1,159 @@ +(.require + [library + [lux (.except def global) + [abstract + [monad (.only do)]] + [control + ["?" parser] + ["[0]" exception (.only exception)] + ["[0]" maybe] + [function + [predicate (.only Predicate)]]] + [data + ["[0]" text (.use "[1]#[0]" equivalence monoid)] + [collection + ["[0]" list (.only) + ["[0]" property]]]] + ["[0]" meta (.only) + ["[0]" symbol (.use "[1]#[0]" codec)] + ["[0]" code (.only) + ["?[1]" \\parser]]]]] + ["[0]" // (.only) + [syntax (.only syntax)] + ["^" pattern]]) + +(type .public Stack + List) + +(exception .public (no_definition [it Symbol]) + (exception.report + "Definition" (symbol#encoded it))) + +(.def (global it) + (-> Symbol (Meta Any)) + (do meta.monad + [.let [[@ expected_name] it] + defs (meta.definitions @)] + (case (list.one (function (_ [actual_name [exported? type value]]) + (if (text#= expected_name actual_name) + {.#Some value} + {.#None})) + defs) + {.#Some it} + (in it) + + {.#None} + (meta.failure (exception.error ..no_definition [it]))))) + +(exception .public no_active_context) + +(.def (peek' _ context) + (All (_ a) (-> (Stack a) Symbol (Meta a))) + (do meta.monad + [stack (..global context)] + (case (|> stack + (as (Stack Any)) + list.head) + {.#Some top} + (in (as_expected top)) + + {.#None} + (meta.failure (exception.error ..no_active_context []))))) + +(.def .public peek + (syntax (_ [g!it (at ?.monad each code.symbol ?code.global)]) + (in (list (` ((,! ..peek') (, g!it) (.symbol (, g!it)))))))) + +(exception .public no_example) + +(.def (search' _ ? context) + (All (_ a) (-> (Stack a) (Predicate a) Symbol (Meta a))) + (do meta.monad + [stack (..global context)] + (case (|> stack + (as (Stack Any)) + (list.example (as (Predicate Any) ?))) + {.#Some it} + (in (as_expected it)) + + {.#None} + (meta.failure (exception.error ..no_example []))))) + +(.def .public search + (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) + g!? ?code.any]) + (in (list (` ((,! ..search') (, g!context) (, g!?) (.symbol (, g!context)))))))) + +(.def (alter on_definition [@ context]) + (-> (-> Definition Definition) Symbol (Meta Any)) + (function (_ lux) + (let [on_global (is (-> Global Global) + (function (_ it) + (case it + {.#Definition it} + {.#Definition (on_definition it)} + + _ + it))) + on_globals (is (-> (property.List Global) (property.List Global)) + (property.revised context on_global)) + on_module (is (-> Module Module) + (revised .#definitions on_globals))] + {.#Right [(revised .#modules (property.revised @ on_module) lux) + []]}))) + +(.def (push' _ top) + (All (_ a) (-> (Stack a) a Symbol (Meta Any))) + (alter (function (_ [exported? type stack]) + (|> stack + (as (Stack Any)) + {.#Item top} + (is (Stack Any)) + [exported? type])))) + +(.def .public push + (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) + g!it ?code.any]) + (in (list (` ((,! ..push') (, g!context) (, g!it) (.symbol (, g!context)))))))) + +(.def pop' + (-> Symbol (Meta Any)) + (alter (function (_ [exported? type value]) + [exported? type (let [value (as (Stack Any) value)] + (maybe.else value (list.tail value)))]))) + +(.def .public pop + (syntax (_ [expression? ?code.bit + context ?code.global]) + (do meta.monad + [_ (..pop' context)] + (in (if expression? + (list (' [])) + (list)))))) + +(.def .public def + (syntax (_ [.let [! ?.monad + ?local (at ! each code.local ?code.local)] + [$ g!expression g!declaration] (?code.tuple (all ?.and ?code.local ?local ?local)) + context_type ?code.any]) + (do [! meta.monad] + [@ meta.current_module_name + .let [g!context (code.symbol [@ $])]] + (//.with_symbols [g!it g!body g!_] + (in (list (` (.def (, (code.local $)) + (..Stack (, context_type)) + (list))) + (` (.def ((, g!expression) (, g!it) (, g!body)) + (-> (, context_type) Code (Meta Code)) + ((,! do) (,! meta.monad) + [(, g!_) ((,! ..push) (, g!context) (, g!it))] + ((,' in) (` (let [((,' ,') (, g!body)) ((,' ,) (, g!body)) + ((,' ,') (, g!_)) ((,! ..pop) #1 (, g!context))] + ((,' ,') (, g!body)))))))) + (` (.def ((, g!declaration) (, g!it) (, g!body)) + (-> (, context_type) Code (Meta (List Code))) + ((,! do) (,! meta.monad) + [(, g!_) ((,! ..push) (, g!context) (, g!it))] + ((,' in) (list (, g!body) + (` ((,! ..pop) #0 (, g!context)))))))) + )))))) diff --git a/stdlib/source/library/lux/meta/macro/local.lux b/stdlib/source/library/lux/meta/macro/local.lux new file mode 100644 index 000000000..9b2ec3156 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/local.lux @@ -0,0 +1,144 @@ +(.require + [library + [lux (.except with let) + [abstract + ["[0]" monad (.only do)]] + [control + ["<>" parser] + ["[0]" try (.only Try)] + ["[0]" exception (.only exception)]] + [data + ["[0]" product] + ["[0]" text] + [collection + ["[0]" list (.use "[1]#[0]" functor) + ["[0]" property]]]] + ["[0]" meta (.only) + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] + ["[0]" // (.only) + [syntax (.only syntax)]]) + +(exception .public (unknown_module [module Text]) + (exception.report + "Module" (text.format module))) + +(with_template [] + [(exception .public ( [module Text + definition Text]) + (exception.report + "Module" (text.format module) + "Definition" (text.format definition)))] + + [cannot_shadow_definition] + [unknown_definition] + ) + +(def (with_module name body) + (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) + (function (_ compiler) + (case (|> compiler (the .#modules) (property.value name)) + {.#Some module} + (case (body module) + {try.#Success [module' output]} + {try.#Success [(revised .#modules (property.has name module') compiler) + output]} + + {try.#Failure error} + {try.#Failure error}) + + {.#None} + (exception.except ..unknown_module [name])))) + +(def (push_one [name macro]) + (-> [Symbol Macro] (Meta Any)) + (do meta.monad + [[module_name definition_name] (meta.normal name) + .let [definition (is Global {.#Definition [false .Macro macro]}) + add_macro! (is (-> (property.List Global) (property.List Global)) + (property.has definition_name definition))]] + (..with_module module_name + (function (_ module) + (case (|> module (the .#definitions) (property.value definition_name)) + {.#None} + {try.#Success [(revised .#definitions add_macro! module) + []]} + + {.#Some _} + (exception.except ..cannot_shadow_definition [module_name definition_name])))))) + +(def (pop_one name) + (-> Symbol (Meta Any)) + (do meta.monad + [[module_name definition_name] (meta.normal name) + .let [lacks_macro! (is (-> (property.List Global) (property.List Global)) + (property.lacks definition_name))]] + (..with_module module_name + (function (_ module) + (case (|> module (the .#definitions) (property.value definition_name)) + {.#Some _} + {try.#Success [(revised .#definitions lacks_macro! module) + []]} + + {.#None} + (exception.except ..unknown_definition [module_name definition_name])))))) + +(def (pop_all macros self) + (-> (List Symbol) Symbol Macro) + ("lux macro" + (function (_ _) + (do [! meta.monad] + [_ (monad.each ! ..pop_one macros) + _ (..pop_one self) + compiler meta.compiler_state] + (in (case (the .#expected compiler) + {.#Some _} + (list (' [])) + + {.#None} + (list))))))) + +(def .public (push macros) + (-> (List [Symbol Macro]) (Meta Code)) + (do meta.monad + [_ (monad.each meta.monad ..push_one macros) + seed meta.seed + g!pop (//.symbol "pop") + _ (.let [g!pop (is Symbol + ["" (code.format g!pop)])] + (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))] + (in (` ((, g!pop)))))) + +(def .public (with macros expression? body) + (-> (List [Symbol Macro]) Bit Code (Meta (List Code))) + (do [! meta.monad] + [g!pop (..push macros)] + (.if expression? + (//.with_symbols [g!body] + (in (list (` (.let [(, g!body) (, body)] + (exec + (, g!pop) + (, g!body))))))) + (in (list body + g!pop))))) + +(def .public let + (syntax (_ [locals (.tuple (<>.some (<>.and .local .any))) + body .any]) + (do [! meta.monad] + [here_name meta.current_module_name + locals (monad.each ! (function (_ [name value]) + (|> value + (meta.eval .Macro) + (at ! each (|>> (as .Macro) + [[here_name name]])))) + locals) + expression? (is (Meta Bit) + (function (_ lux) + {try.#Success [lux (case (the .#expected lux) + {.#None} + false + + {.#Some _} + true)]}))] + (..with locals expression? body)))) diff --git a/stdlib/source/library/lux/meta/macro/pattern.lux b/stdlib/source/library/lux/meta/macro/pattern.lux new file mode 100644 index 000000000..affa8273a --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/pattern.lux @@ -0,0 +1,256 @@ +(.require + [library + [lux (.except or let with_template |> `)]]) + +(def partial_list + (`` ("lux in-module" (,, (static .prelude)) .partial_list))) + +(def locally + (macro (_ tokens lux) + (.let [[prelude _] (symbol ._)] + (case tokens + (pattern (list [@ {.#Symbol ["" name]}])) + {.#Right [lux (list (.` ("lux in-module" (, [@ {.#Text prelude}]) + (, [@ {.#Symbol [prelude name]}]))))]} + + _ + {.#Left ""})))) + +(.with_template [] + [(def (..locally ))] + + [list#size] + [list#composite] + [list#each] + [list#conjoint] + [every?] + + [maybe#monad] + + [function#composite] + + [failure] + [meta#in] + + [do] + [monad#each] + + [Replacement_Environment] + [realized_template] + [replacement_environment] + + [symbol_short] + [tuple_list] + + [meta#monad] + [text$] + [generated_symbol] + [type_definition] + [record_slots] + [text#composite] + [type#encoded] + [module_alias] + [symbol$] + [tuple$] + [monad#mix] + [zipped_2] + + [multi_level_case^] + [multi_level_case$] + [type_code] + [expected_type] + + [wrong_syntax_error] + [local$] + + [list#reversed] + [untemplated_list] + [bit$] + [nat$] + [int$] + [rev$] + [frac$] + ) + +(def .public or + (macro (_ tokens) + (case tokens + (pattern (partial_list [_ {.#Form patterns}] body branches)) + (case patterns + {.#End} + (failure (..wrong_syntax_error (symbol ..or))) + + _ + (.let [pairs (.|> patterns + (list#each (function (_ pattern) (list pattern body))) + list#conjoint)] + (meta#in (list#composite pairs branches)))) + _ + (failure (..wrong_syntax_error (symbol ..or)))))) + +(def .public with_template + (macro (_ tokens) + (case tokens + (pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}] + [_ {.#Tuple templates}])}] + [_ {.#Form data}] + branches)) + (case (is (Maybe (List Code)) + (do maybe#monad + [bindings' (monad#each maybe#monad symbol_short bindings) + data' (monad#each maybe#monad tuple_list data)] + (.let [num_bindings (list#size bindings')] + (if (every? (|>> ("lux i64 =" num_bindings)) + (list#each list#size data')) + (.let [apply (is (-> Replacement_Environment (List Code)) + (function (_ env) (list#each (realized_template env) templates)))] + (.|> data' + (list#each (function#composite apply (replacement_environment bindings'))) + list#conjoint + in)) + {.#None})))) + {.#Some output} + (meta#in (list#composite output branches)) + + {.#None} + (failure (..wrong_syntax_error (symbol ..with_template)))) + + _ + (failure (..wrong_syntax_error (symbol ..with_template)))))) + +(def .public multi + (macro (_ tokens) + (case tokens + (pattern (partial_list [_meta {.#Form levels}] body next_branches)) + (do meta#monad + [mlc (multi_level_case^ levels) + .let [initial_bind? (case mlc + [[_ {.#Symbol _}] _] + #1 + + _ + #0)] + expected ..expected_type + g!temp (..generated_symbol "temp")] + (in (list g!temp + (.` ({{.#Some (, g!temp)} + (, g!temp) + + {.#None} + (.case (, g!temp) + (,* next_branches))} + ("lux type check" {.#Apply (, (type_code expected)) Maybe} + (.case (, g!temp) + (,* (multi_level_case$ g!temp [mlc body])) + + (,* (if initial_bind? + (list) + (list g!temp (.` {.#None}))))))))))) + + _ + (failure (..wrong_syntax_error (symbol ..multi)))))) + +(def .public let + (macro (_ tokens) + (case tokens + (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] pattern)}] body branches)) + (.let [g!whole (local$ name)] + (meta#in (partial_list g!whole + (.` (case (, g!whole) (, pattern) (, body))) + branches))) + + _ + (failure (..wrong_syntax_error (symbol ..let)))))) + +(def .public |> + (macro (_ tokens) + (case tokens + (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] [_ {.#Tuple steps}])}] body branches)) + (.let [g!name (local$ name)] + (meta#in (partial_list g!name + (.` (.let [(, g!name) (.|> (, g!name) (,* steps))] + (, body))) + branches))) + + _ + (failure (..wrong_syntax_error (symbol ..|>)))))) + +(def (name$ [module name]) + (-> Symbol Code) + (.` [(, (text$ module)) (, (text$ name))])) + +(def (untemplated_partial_list last inits) + (-> Code (List Code) Code) + (case inits + {.#End} + last + + {.#Item [init inits']} + (.` {.#Item (, init) (, (untemplated_partial_list last inits'))}))) + +(.with_template [ ] + [(def ( g!meta untemplated_pattern elems) + (-> Code (-> Code (Meta Code)) + (-> (List Code) (Meta Code))) + (case (list#reversed elems) + {.#Item [_ {.#Form {.#Item [[_ {.#Symbol ["" ",*"]}] {.#Item [spliced {.#End}]}]}}] + inits} + (do meta#monad + [=inits (monad#each meta#monad untemplated_pattern (list#reversed inits))] + (in (.` [(, g!meta) { (, (untemplated_partial_list spliced =inits))}]))) + + _ + (do meta#monad + [=elems (monad#each meta#monad untemplated_pattern elems)] + (in (.` [(, g!meta) { (, (untemplated_list =elems))}])))))] + + [.#Form untemplated_form] + [.#Variant untemplated_variant] + [.#Tuple untemplated_tuple] + ) + +(def (untemplated_pattern pattern) + (-> Code (Meta Code)) + (do meta#monad + [g!meta (..generated_symbol "g!meta")] + (case pattern + (..with_template [ ] + [[_ { value}] + (in (.` [(, g!meta) { (, ( value))}]))]) + ([.#Bit bit$] + [.#Nat nat$] + [.#Int int$] + [.#Rev rev$] + [.#Frac frac$] + [.#Text text$] + [.#Symbol name$]) + + [_ {.#Form {.#Item [[_ {.#Symbol ["" ","]}] {.#Item [unquoted {.#End}]}]}}] + (in unquoted) + + [_ {.#Form {.#Item [[_ {.#Symbol ["" ",*"]}] {.#Item [spliced {.#End}]}]}}] + (failure "Cannot use (,*) inside of `code` unless it is the last element in a form or a tuple.") + + (..with_template [ ] + [[_ { elems}] + ( g!meta untemplated_pattern elems)]) + ([.#Form ..untemplated_form] + [.#Variant ..untemplated_variant] + [.#Tuple ..untemplated_tuple]) + ))) + +(def .public ` + (macro (_ tokens) + (case tokens + (pattern (partial_list [_meta {.#Form (list template)}] body branches)) + (do meta#monad + [pattern (untemplated_pattern template)] + (in (partial_list pattern body branches))) + + (pattern (list template)) + (do meta#monad + [pattern (untemplated_pattern template)] + (in (list pattern))) + + _ + (failure (..wrong_syntax_error (symbol ..`)))))) diff --git a/stdlib/source/library/lux/meta/macro/syntax.lux b/stdlib/source/library/lux/meta/macro/syntax.lux new file mode 100644 index 000000000..5321db403 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax.lux @@ -0,0 +1,99 @@ +(.require + [library + [lux (.except) + [abstract + ["[0]" monad (.only do)]] + [control + ["<>" parser] + ["[0]" try]] + [data + ["[0]" text (.use "[1]#[0]" monoid)] + [collection + ["[0]" list]]] + ["[0]" meta (.only) + ["[0]" code (.only) + ["" \\parser (.only Parser)]]]]] + ["[0]" // (.only with_symbols)]) + +(def (self_documenting binding parser) + (All (_ a) (-> Code (Parser a) (Parser a))) + (function (_ tokens) + (case (parser tokens) + {try.#Failure error} + {try.#Failure (all text#composite + "Failed to parse: " (code.format binding) text.new_line + error)} + + success + success))) + +(def (un_paired pairs) + (All (_ a) (-> (List [a a]) (List a))) + (case pairs + {.#Item [x y] pairs'} + (list.partial x y (un_paired pairs')) + + {.#End} + {.#End})) + +(def syntaxP + (Parser [[Text (Maybe Text) (List Code)] Code]) + (all <>.and + (.form (all <>.and + .local + (<>.maybe .local) + (.tuple (<>.some .any)))) + .any)) + +(def .public syntax + (macro (_ tokens) + (case (.result ..syntaxP tokens) + {try.#Success [[name g!state args] body]} + (with_symbols [g!tokens g!body g!error] + (do [! meta.monad] + [vars+parsers (case (list.pairs args) + {.#Some args} + (monad.each ! + (is (-> [Code Code] (Meta [Code Code])) + (function (_ [var parser]) + (with_expansions [ (in [var + (` ((,! ..self_documenting) (' (, var)) + (, parser)))])] + (case var + [_ {.#Symbol ["" _]}] + + + [_ {.#Symbol _}] + (in [var parser]) + + _ + )))) + args) + + _ + (meta.failure "Syntax pattern expects pairs of bindings and code-parsers.")) + g!state (case g!state + {.#Some g!state} + (in (code.local g!state)) + + {.#None} + (//.symbol "g!state")) + this_module meta.current_module_name + .let [g!name (code.symbol ["" name])]] + (in (list (` (.macro ((, g!name) (, g!tokens) (, g!state)) + (.case ((,! .result) + (is ((,! .Parser) (Meta (List Code))) + ((,! do) (,! <>.monad) + [(,* (..un_paired vars+parsers))] + (.at (,! <>.monad) (,' in) + (is (Meta (List Code)) + (, body))))) + (, g!tokens)) + {try.#Success (, g!body)} + ((, g!body) (, g!state)) + + {try.#Failure (, g!error)} + {try.#Failure ((,! text.interposed) (,! text.new_line) (list "Invalid syntax:" (, g!error)))}))))))) + + {try.#Failure error} + (meta.failure (//.wrong_syntax_error (symbol ..syntax)))))) diff --git a/stdlib/source/library/lux/meta/macro/syntax/check.lux b/stdlib/source/library/lux/meta/macro/syntax/check.lux new file mode 100644 index 000000000..21a8aff54 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/check.lux @@ -0,0 +1,41 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)] + [monad (.only do)]] + [control + ["<>" parser]] + [data + ["[0]" product]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) + +(def extension + "lux check") + +(type .public Check + (Record + [#type Code + #value Code])) + +(def .public equivalence + (Equivalence Check) + (all product.equivalence + code.equivalence + code.equivalence + )) + +(def .public (format (open "_[0]")) + (-> Check Code) + (` ((, (code.text ..extension)) + (, _#type) + (, _#value)))) + +(def .public parser + (Parser Check) + (<| .form + (<>.after (.this_text ..extension)) + (<>.and .any + .any))) diff --git a/stdlib/source/library/lux/meta/macro/syntax/declaration.lux b/stdlib/source/library/lux/meta/macro/syntax/declaration.lux new file mode 100644 index 000000000..1f4a9cccd --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/declaration.lux @@ -0,0 +1,44 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)]] + [control + ["<>" parser (.use "[1]#[0]" monad)]] + [data + ["[0]" product] + ["[0]" text] + [collection + ["[0]" list (.use "[1]#[0]" functor)]]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) + +(type .public Declaration + (Record + [#name Text + #arguments (List Text)])) + +(def .public equivalence + (Equivalence Declaration) + (all product.equivalence + text.equivalence + (list.equivalence text.equivalence) + )) + +(def .public parser + (Parser Declaration) + (<>.either (<>.and .local + (<>#in (list))) + (.form (<>.and .local + (<>.some .local))))) + +(def .public (format value) + (-> Declaration Code) + (let [g!name (code.local (the #name value))] + (case (the #arguments value) + {.#End} + g!name + + arguments + (` ((, g!name) (,* (list#each code.local arguments))))))) diff --git a/stdlib/source/library/lux/meta/macro/syntax/definition.lux b/stdlib/source/library/lux/meta/macro/syntax/definition.lux new file mode 100644 index 000000000..750c94d60 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/definition.lux @@ -0,0 +1,97 @@ +(.require + [library + [lux (.except Definition) + [abstract + [equivalence (.only Equivalence)] + [monad (.only do)]] + [control + ["<>" parser] + ["[0]" exception (.only exception)]] + [data + ["[0]" sum] + ["[0]" product] + ["[0]" bit] + ["[0]" text (.only) + ["%" \\format]] + [collection + ["[0]" list]]] + ["[0]" meta (.only) + ["[0]" location] + ["[0]" macro] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]] + ["[0]" // (.only) + ["[1][0]" check (.only Check)]]) + +(type .public Definition + (Record + [#name Text + #value (Either Check + Code) + #export? Bit])) + +(def .public equivalence + (Equivalence Definition) + (all product.equivalence + text.equivalence + (all sum.equivalence + //check.equivalence + code.equivalence + ) + bit.equivalence + )) + +(def extension + "lux def") + +(def dummy + Code + (` [.#module (, (code.text (the .#module location.dummy))) + .#line (, (code.nat (the .#line location.dummy))) + .#column (, (code.nat (the .#column location.dummy)))])) + +(def .public (format (open "_[0]")) + (-> Definition Code) + (` ((, (code.text ..extension)) + (, (code.local _#name)) + (, (case _#value + {.#Left check} + (//check.format check) + + {.#Right value} + value)) + (, (code.bit _#export?))))) + +(def .public (parser compiler) + (-> Lux (Parser Definition)) + (do [! <>.monad] + [raw .any + me_raw (|> raw + macro.full_expansion + (meta.result compiler) + <>.lifted)] + (<| (.locally me_raw) + .form + (<>.after (.this_text ..extension)) + (all <>.and + .local + (<>.or //check.parser + .any) + .bit + )))) + +(exception .public (lacks_type [definition Definition]) + (exception.report + "Definition" (%.code (..format definition)))) + +(def .public (typed compiler) + (-> Lux (Parser Definition)) + (do <>.monad + [definition (..parser compiler) + _ (case (the #value definition) + {.#Left _} + (in []) + + {.#Right _} + (<>.lifted (exception.except ..lacks_type [definition])))] + (in definition))) diff --git a/stdlib/source/library/lux/meta/macro/syntax/export.lux b/stdlib/source/library/lux/meta/macro/syntax/export.lux new file mode 100644 index 000000000..d68b4a678 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/export.lux @@ -0,0 +1,37 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [control + ["<>" parser]] + [meta + ["[0]" code + ["<[1]>" \\parser (.only Parser)]] + [macro + ["^" pattern]]]]]) + +(def .public default_policy + Code + (` .private)) + +(def policy + (Parser Code) + (do [! <>.monad] + [candidate .next] + (case candidate + [_ {.#Symbol ["" _]}] + (in default_policy) + + (^.or [_ {.#Bit _}] + [_ {.#Symbol _}]) + (do ! + [_ .any] + (in candidate)) + + _ + (in default_policy)))) + +(def .public parser + (All (_ a) (-> (Parser a) (Parser [Code a]))) + (<>.and ..policy)) diff --git a/stdlib/source/library/lux/meta/macro/syntax/input.lux b/stdlib/source/library/lux/meta/macro/syntax/input.lux new file mode 100644 index 000000000..4461c7df9 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/input.lux @@ -0,0 +1,43 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)]] + [control + ["<>" parser]] + [data + ["[0]" product] + [collection + ["[0]" list (.use "[1]#[0]" monad)]]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) + +(type .public Input + (Record + [#binding Code + #type Code])) + +(def .public equivalence + (Equivalence Input) + (all product.equivalence + code.equivalence + code.equivalence + )) + +(def .public format + (-> (List Input) Code) + (|>> (list#each (function (_ value) + (list (the #binding value) + (the #type value)))) + list#conjoint + code.tuple)) + +(def .public parser + (Parser (List Input)) + (<| .tuple + <>.some + (all <>.and + .any + .any + ))) diff --git a/stdlib/source/library/lux/meta/macro/syntax/type/variable.lux b/stdlib/source/library/lux/meta/macro/syntax/type/variable.lux new file mode 100644 index 000000000..363f85fc0 --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/syntax/type/variable.lux @@ -0,0 +1,25 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)]] + [data + ["[0]" text]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) + +(type .public Variable + Text) + +(def .public equivalence + (Equivalence Variable) + text.equivalence) + +(def .public format + (-> Variable Code) + code.local) + +(def .public parser + (Parser Variable) + .local) diff --git a/stdlib/source/library/lux/meta/macro/template.lux b/stdlib/source/library/lux/meta/macro/template.lux new file mode 100644 index 000000000..20cd85f2b --- /dev/null +++ b/stdlib/source/library/lux/meta/macro/template.lux @@ -0,0 +1,184 @@ +(.require + [library + [lux (.except let local symbol macro) + [abstract + ["[0]" monad (.only do)]] + [control + ["<>" parser (.use "[1]#[0]" functor)] + ["[0]" try (.only Try)] + ["[0]" exception (.only exception)]] + [data + ["[0]" bit (.use "[1]#[0]" codec)] + ["[0]" text] + [collection + ["[0]" list (.use "[1]#[0]" monad)] + ["[0]" dictionary (.only Dictionary)]]] + [math + [number + ["[0]" nat (.use "[1]#[0]" decimal)] + ["[0]" int (.use "[1]#[0]" decimal)] + ["[0]" rev (.use "[1]#[0]" decimal)] + ["[0]" frac (.use "[1]#[0]" decimal)]]] + ["[0]" meta (.only) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]] + ["[0]" // (.only) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" local]]) + +(def .public spliced + (syntax (_ [parts (.tuple (<>.some .any))]) + (in parts))) + +(def .public amount + (syntax (_ [parts (.tuple (<>.some .any))]) + (in (list (code.nat (list.size parts)))))) + +(def .public with_locals + (syntax (_ [locals (.tuple (<>.some .local)) + body .any]) + (do [! meta.monad] + [g!locals (|> locals + (list#each //.symbol) + (monad.all !))] + (in (list (` (.with_expansions [(,* (|> (list.zipped_2 locals g!locals) + (list#each (function (_ [name symbol]) + (list (code.local name) symbol))) + list#conjoint))] + (, body)))))))) + +(def (symbol_side module_side? parser) + (-> Bit (Parser Symbol) (Parser Text)) + (do <>.monad + [[module short] parser] + (in (if module_side? + (case module + "" short + _ module) + short)))) + +(def (snippet module_side?) + (-> Bit (Parser Text)) + (.let [full_symbol (..symbol_side module_side? .symbol)] + (all <>.either + .text + (if module_side? + full_symbol + (<>.either .local + full_symbol)) + (<>#each bit#encoded .bit) + (<>#each nat#encoded .nat) + (<>#each int#encoded .int) + (<>#each rev#encoded .rev) + (<>#each frac#encoded .frac) + ))) + +(def (part module_side?) + (-> Bit (Parser (List Text))) + (.tuple (<>.many (..snippet module_side?)))) + +(def .public text + (syntax (_ [simple (..part false)]) + (in (list (|> simple (text.interposed "") code.text))))) + +(with_template [ ] + [(def .public + (syntax (_ [name (<>.or (<>.and (..part true) (..part false)) + (..part false))]) + (case name + {.#Left [simple complex]} + (in (list ( [(text.interposed "" simple) + (text.interposed "" complex)]))) + + {.#Right simple} + (in (list (|> simple (text.interposed "") ))))))] + + [symbol code.local code.symbol] + ) + +(type Environment + (Dictionary Text Code)) + +(def (applied env template) + (-> Environment Code Code) + (case template + [_ {.#Symbol "" name}] + (case (dictionary.value name env) + {.#Some substitute} + substitute + + {.#None} + template) + + (^.with_template [] + [[meta { elems}] + [meta { (list#each (applied env) elems)}]]) + ([.#Form] + [.#Variant] + [.#Tuple]) + + _ + template)) + +(type Local + (Record + [#name Text + #parameters (List Text) + #template (List Code)])) + +(exception .public (irregular_arguments [expected Nat + actual Nat]) + (exception.report + "Expected" (at nat.decimal encoded expected) + "Actual" (at nat.decimal encoded actual))) + +(def (macro (open "_[0]")) + (-> Local Macro) + ("lux macro" + (function (_ inputs compiler) + (.let [parameters_amount (list.size _#parameters) + inputs_amount (list.size inputs)] + (if (nat.= parameters_amount inputs_amount) + (.let [environment (is Environment + (|> (list.zipped_2 _#parameters inputs) + (dictionary.of_list text.hash)))] + {.#Right [compiler (list#each (..applied environment) _#template)]}) + (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) + +(def local + (Parser Local) + (do <>.monad + [[name parameters] (.form (<>.and .local + (<>.many .local))) + template (.tuple (<>.some .any))] + (in [#name name + #parameters parameters + #template template]))) + +... TODO: Get rid of this (and any local definitions it depends on) once the bootstrapping compiler is gone. +(def .public let + (syntax (_ [locals (.tuple (<>.some ..local)) + body .any]) + (do meta.monad + [here_name meta.current_module_name + expression? (is (Meta Bit) + (function (_ lux) + {try.#Success [lux (case (the .#expected lux) + {.#None} + false + + {.#Some _} + true)]})) + g!pop (local.push (list#each (function (_ local) + [[here_name (the #name local)] + (..macro local)]) + locals))] + (if expression? + (//.with_symbols [g!body] + (in (list (` (.let [(, g!body) (, body)] + (exec + (, g!pop) + (, g!body))))))) + (in (list body + g!pop)))))) diff --git a/stdlib/source/library/lux/meta/type.lux b/stdlib/source/library/lux/meta/type.lux index af6ee1351..1664ce98a 100644 --- a/stdlib/source/library/lux/meta/type.lux +++ b/stdlib/source/library/lux/meta/type.lux @@ -15,9 +15,6 @@ [collection ["[0]" array] ["[0]" list (.use "[1]#[0]" monad monoid mix)]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["^" pattern]] [math [number ["n" nat (.use "[1]#[0]" decimal)]]] @@ -25,7 +22,10 @@ ["[0]" location] ["[0]" symbol (.use "[1]#[0]" equivalence codec)] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]]) + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["^" pattern]]]]]) (with_template [ ] [(def .public ( type) diff --git a/stdlib/source/library/lux/meta/type/check.lux b/stdlib/source/library/lux/meta/type/check.lux index cb49cc6e4..60c1f0e5c 100644 --- a/stdlib/source/library/lux/meta/type/check.lux +++ b/stdlib/source/library/lux/meta/type/check.lux @@ -16,11 +16,12 @@ [collection ["[0]" list (.use "[1]#[0]" mix)] ["[0]" set (.only Set)]]] - [macro - ["^" pattern]] [math [number - ["n" nat (.use "[1]#[0]" decimal)]]]]] + ["n" nat (.use "[1]#[0]" decimal)]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // (.use "[1]#[0]" equivalence)]) (def !n#= diff --git a/stdlib/source/library/lux/meta/type/dynamic.lux b/stdlib/source/library/lux/meta/type/dynamic.lux index eccb312e2..ea4635966 100644 --- a/stdlib/source/library/lux/meta/type/dynamic.lux +++ b/stdlib/source/library/lux/meta/type/dynamic.lux @@ -8,11 +8,11 @@ [data [text ["%" \\format]]] - [macro (.only with_symbols) - ["[0]" syntax (.only syntax)]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro (.only with_symbols) + ["[0]" syntax (.only syntax)]]]]] ["[0]" // (.only) ["[0]" primitive (.only primitive)]]) diff --git a/stdlib/source/library/lux/meta/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux index 3d92d214c..64bcb5469 100644 --- a/stdlib/source/library/lux/meta/type/implicit.lux +++ b/stdlib/source/library/lux/meta/type/implicit.lux @@ -15,14 +15,14 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" dictionary (.only Dictionary)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" number (.only) ["n" nat]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] ["[0]" // (.use "[1]#[0]" equivalence) ["/[1]" //] ["[0]" check (.only Check)]]) diff --git a/stdlib/source/library/lux/meta/type/poly.lux b/stdlib/source/library/lux/meta/type/poly.lux index 912a22a9b..abf1d8c5b 100644 --- a/stdlib/source/library/lux/meta/type/poly.lux +++ b/stdlib/source/library/lux/meta/type/poly.lux @@ -12,15 +12,15 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary]]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["^" pattern]] [math [number ["n" nat]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["^" pattern]]]]] ["[0]" // (.only) ["<[1]>" \\parser (.only Env)] ["/[1]" //]]) diff --git a/stdlib/source/library/lux/meta/type/primitive.lux b/stdlib/source/library/lux/meta/type/primitive.lux index 339612998..c1ead54eb 100644 --- a/stdlib/source/library/lux/meta/type/primitive.lux +++ b/stdlib/source/library/lux/meta/type/primitive.lux @@ -10,15 +10,15 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - ["[0]" macro (.only) - ["^" pattern] - ["[0]" context] - [syntax (.only syntax) - ["|[0]|" export]]] [meta ["[0]" symbol (.use "[1]#[0]" codec)] ["[0]" code (.only) - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + ["^" pattern] + ["[0]" context] + [syntax (.only syntax) + ["|[0]|" export]]]]]] ["[0]" //]) (type .public Frame diff --git a/stdlib/source/library/lux/meta/type/quotient.lux b/stdlib/source/library/lux/meta/type/quotient.lux index e6553fb40..a872c9992 100644 --- a/stdlib/source/library/lux/meta/type/quotient.lux +++ b/stdlib/source/library/lux/meta/type/quotient.lux @@ -3,11 +3,11 @@ [lux (.except type) [abstract [equivalence (only Equivalence)]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)]]]]] ["[0]" // (.only) [primitive (.except)]]) diff --git a/stdlib/source/library/lux/meta/type/refinement.lux b/stdlib/source/library/lux/meta/type/refinement.lux index e5c18decf..b08bdd5e9 100644 --- a/stdlib/source/library/lux/meta/type/refinement.lux +++ b/stdlib/source/library/lux/meta/type/refinement.lux @@ -4,11 +4,11 @@ [control [function [predicate (.only Predicate)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] ["[0]" // (.only) [primitive (.except)]]) diff --git a/stdlib/source/library/lux/meta/type/resource.lux b/stdlib/source/library/lux/meta/type/resource.lux index f1e099e72..1f7ead9f5 100644 --- a/stdlib/source/library/lux/meta/type/resource.lux +++ b/stdlib/source/library/lux/meta/type/resource.lux @@ -15,14 +15,14 @@ ["[0]" set] ["[0]" sequence (.only Sequence)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code - ["<[1]>" \\parser (.only Parser)]]]]] + ["<[1]>" \\parser (.only Parser)]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [// [primitive (.except)]]) diff --git a/stdlib/source/library/lux/meta/type/unit.lux b/stdlib/source/library/lux/meta/type/unit.lux index e0b0af638..cb8b9c142 100644 --- a/stdlib/source/library/lux/meta/type/unit.lux +++ b/stdlib/source/library/lux/meta/type/unit.lux @@ -5,14 +5,14 @@ [equivalence (.only Equivalence)] [order (.only Order)] [enum (.only Enum)]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number ["i" int]]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] ["[0]" // (.only) [primitive (.except)]]) diff --git a/stdlib/source/library/lux/meta/type/unit/scale.lux b/stdlib/source/library/lux/meta/type/unit/scale.lux index f1bbdb08f..9d750eea9 100644 --- a/stdlib/source/library/lux/meta/type/unit/scale.lux +++ b/stdlib/source/library/lux/meta/type/unit/scale.lux @@ -1,15 +1,15 @@ (.require [library [lux (.except type) - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number ["i" int] ["[0]" ratio (.only Ratio)]]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] ["[0]" // (.only) ["/[1]" //]]) diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux index 7c3eaf426..0bee9801e 100644 --- a/stdlib/source/library/lux/meta/version.lux +++ b/stdlib/source/library/lux/meta/version.lux @@ -10,11 +10,11 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - [syntax (.only syntax)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]] [tool [compiler [version (.only Version)]]]]]) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index 442038fdf..02c0c6179 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -9,11 +9,11 @@ ["[0]" io] [concurrency ["[0]" thread]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)]]]]] ["" \\parser]) (type Arguments diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index 375664915..617ce7cdb 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -8,14 +8,14 @@ [data [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)]] [math [number (.only hex)] ["[0]" random (.only Random)]] ["[0]" meta (.use "[1]#[0]" functor) ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]]) (with_template [ ] [(def .public diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index aeb290691..b7ce2a7fb 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -8,12 +8,12 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" monad monoid)]]] - [macro - ["[0]" template]] [math [number ["f" frac]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index 29816e610..e5a1ce144 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -8,13 +8,13 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [math [number ["i" int] ["f" frac]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 3167f2516..0b0af146e 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -11,11 +11,12 @@ ["[0]" product] ["[0]" binary ["[1]F" \\format (.only Format)]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // ["[1][0]" index (.only Index)] ["[1][0]" type (.only Type) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index ca0c92f65..906216326 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -20,14 +20,15 @@ ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)] ["[0]" sequence (.only Sequence)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] ["i" int] - ["[0]" i32 (.only I32)]]]]] + ["[0]" i32 (.only I32)]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]]]] ["[0]" / ["_" instruction (.only Primitive_Array_Type Instruction Estimator) (.use "[1]#[0]" monoid)] ["[1][0]" address (.only Address)] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index f9e9d4b07..9dc19ed00 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -16,12 +16,12 @@ ["[0]" \\format (.only Mutation Specification)]] [collection ["[0]" list]]] - [macro - ["[0]" template]] [math [number (.only hex) ["n" nat]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]] ["[0]" // diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index fbd207bdc..e80bef65b 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -12,9 +12,6 @@ ["[0]" text] ["[0]" binary ["[1]F" \\format (.only Format) (.use "[1]#[0]" monoid)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["[0]" i32 (.only I32)] @@ -22,6 +19,9 @@ ["[0]" int] ["[0]" frac]]] [meta + [macro + ["^" pattern] + ["[0]" template]] [type [primitive (.except)]]]]] ["[0]" / diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index ba6304a39..91d7c15c6 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -12,14 +12,14 @@ ["%" \\format (.only format)]] [binary ["[0]" \\format (.only Format)]]] - [macro - ["[0]" template]] [math [number ["[0]" i64] ["n" nat] ["i" int]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index bbc331384..858d06d80 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -12,13 +12,13 @@ ["%" \\format (.only format)]] [binary ["[0]" \\format (.only Format)]]] - [macro - ["[0]" template]] [math [number ["n" nat] ["[0]" i64]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index b76d05904..35b9894be 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -10,16 +10,16 @@ [data ["[0]" binary ["[1]F" \\format (.only Format)]]] - [macro (.only with_symbols) - [syntax (.only syntax)]] [math ["[0]" number (.only hex) ["[0]" i64]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro (.only with_symbols) + [syntax (.only syntax)]] + [type + [primitive (.except)]]]]] ["[0]" // [encoding ["[1][0]" unsigned]]]) diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index cf38c5efa..45a33bb52 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -16,11 +16,12 @@ ["[0]" list (.use "[1]#[0]" mix functor)] ["[0]" array] ["[0]" dictionary]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // [encoding ["[1][0]" name (.only External)]] diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index ad293150e..7cae42458 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -1,9 +1,9 @@ (.require [library [lux (.except Primitive) - [macro - ["[0]" template]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index b0432cbdd..bb8d9bc84 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -13,19 +13,19 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] ["i" int] ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) ... Added the carriage return for better Windows compatibility. (def \n+ diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index ef08c945d..0369549f3 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -13,18 +13,18 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) (def input_separator ", ") (def statement_suffix ";") diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index e1197964b..b02449eb7 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -14,18 +14,18 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) (.def input_separator ", ") diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index 3ddfac43d..f425f584b 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -10,17 +10,17 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) (primitive .public (Code kind) Text diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index dd99e29f7..1d7662bae 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -13,18 +13,18 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] ["f" frac]]] [meta - [type - [primitive (.except)]] ["[0]" code (.only) - ["<[1]>" \\parser]]]]]) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]] + [type + [primitive (.except)]]]]]) (def input_separator ", ") (def statement_suffix ";") diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 6918a872c..e8e39d40e 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -12,13 +12,13 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor monoid)]]] - [macro - ["[0]" template]] [math [number ["n" nat] ["f" frac]]] [meta + [macro + ["[0]" template]] [type [primitive (.except)]]]]]) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 19f0d287b..352207e47 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -24,20 +24,20 @@ ["[0]" set (.only Set)] ["[0]" dictionary ["[1]" ordered (.only Dictionary)]]]] - [time - ["[0]" instant] - ["[0]" duration (.only Duration)]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) ["n" nat] ["f" frac]]] - [macro - [syntax (.only syntax)]] ["[0]" meta (.only) ["[0]" symbol] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]] + [time + ["[0]" instant] + ["[0]" duration (.only Duration)]] [world ["[0]" environment] ["[0]" console]]]]) diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index 2a85f5107..f50c79af1 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -12,12 +12,13 @@ ["[0]" exception (.only exception)]] [data ["[0]" text (.use "[1]#[0]" monoid)]] - [macro - ["^" pattern] - ["[0]" template]] [math [number - ["n" nat]]]]]) + ["n" nat]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]]]]) (type .public Day (Variant diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux index a8e01bc39..385106ea5 100644 --- a/stdlib/source/library/lux/time/month.lux +++ b/stdlib/source/library/lux/time/month.lux @@ -12,12 +12,13 @@ ["[0]" exception (.only exception)]] [data ["[0]" text (.use "[1]#[0]" monoid)]] - [macro - ["^" pattern] - ["[0]" template]] [math [number - ["n" nat]]]]]) + ["n" nat]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]]]]) (type .public Month (Variant diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index f966f9b63..7d015fd6b 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["@" target (.only Target)] - ["[0]" meta] [abstract ["[0]" monad (.only do)]] [control @@ -18,7 +17,7 @@ ["[0]" dictionary] ["[0]" set] ["[0]" sequence (.use "[1]#[0]" functor)]]] - [meta + ["[0]" meta (.only) ["[0]" configuration (.only Configuration)] ["[0]" version]] [world diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index 13d0ba6ed..2442874a0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -17,8 +17,6 @@ ["%" \\format (.only Format)]] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - [syntax (.only syntax)]] [math [number ["n" nat] @@ -29,7 +27,9 @@ ["[0]" location] ["[0]" configuration (.only Configuration)] ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]] ["[0]" / ["[1][0]" simple (.only Simple)] ["[1][0]" complex (.only Tuple Variant Complex)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux index 04023ab5c..aefb5abc7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux @@ -16,15 +16,16 @@ ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)] ["[0]" set (.only Set) (.use "[1]#[0]" equivalence)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat (.use "[1]#[0]" interval)] ["i" int] ["r" rev] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]]]] ["[0]" // ["[1][0]" simple] ["[1][0]" complex] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux index bbffab2a0..d25fb1f8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux @@ -14,13 +14,13 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor monoid)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat]]] [meta + [macro + ["^" pattern] + ["[0]" template]] ["[0]" type (.only) ["[0]" check]]]]] ["/" // (.only Analysis Operation Phase) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux index 73ce2ea01..2e2982214 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux @@ -1,6 +1,7 @@ (.require [library [lux (.except) + ["[0]" meta] [abstract [monad (.only do)]] [control @@ -8,8 +9,7 @@ ["[0]" exception (.only exception)]] [data ["[0]" text - ["%" \\format (.only format)]]] - ["[0]" meta]]] + ["%" \\format (.only format)]]]]] [///// ["[0]" phase]]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux index d9ab4f4a1..33e818a9e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux @@ -1,6 +1,7 @@ (.require [library [lux (.except Label with) + ["[0]" meta] [abstract ["[0]" monad (.only do)]] [control @@ -12,8 +13,7 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" mix functor) - ["[0]" property]]]] - ["[0]" meta]]] + ["[0]" property]]]]]] ["/" // (.only Operation) ["//[1]" // [phase diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux index b87c107ff..4b092ad00 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux @@ -7,14 +7,15 @@ ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only Format)]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["i" int] ["r" rev] - ["f" frac]]]]]) + ["f" frac]]] + [meta + [macro + ["^" pattern]]]]]) (type .public Simple (Variant diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux index 6cfad0d9f..b534b616a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["[0]" meta] [abstract ["[0]" monad (.only do)]] [control @@ -12,12 +11,12 @@ ["%" \\format (.only format)]] [collection ["[0]" list]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] - [meta + ["[0]" meta (.only) + [macro + ["^" pattern]] [type ["[0]" check (.only Check)]]]]] ["/" // (.only Operation) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index bd46c3d8c..c217a6d6c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -16,14 +16,14 @@ ["[0]" sequence (.only Sequence)] ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set (.only Set)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat]]] [meta - ["[0]" symbol]]]] + ["[0]" symbol] + [macro + ["^" pattern] + ["[0]" template]]]]] [// [synthesis (.only Synthesis)] [phase diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux index 5882c78f4..594626581 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux @@ -10,14 +10,14 @@ ["%" \\format (.only format)]] [collection ["[0]" list]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] ["[0]" meta (.only) + ["[0]" location] ["[0]" code] - ["[0]" location]]]] + [macro + ["^" pattern]]]]] ["[0]" / ["[1][0]" simple] ["[1][0]" complex] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index 7301f6b8e..65d951e0a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -16,10 +16,10 @@ [math [number ["n" nat]]] - [macro - ["^" pattern]] ["[0]" meta (.only) ["[0]" code] + [macro + ["^" pattern]] ["[0]" type (.only) ["[0]" check (.only Check)]]]]] ["[0]" / 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 2e43232b3..61daacb2f 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 @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["[0]" meta] [abstract [monad (.only do)]] [control @@ -9,8 +8,9 @@ [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - [macro - ["^" pattern]]]] + ["[0]" meta (.only) + [macro + ["^" pattern]]]]] ["[0]" // ["/[1]" // ["[1][0]" extension] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index c8ffe0bb7..36a7deaa1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -16,8 +16,9 @@ [collection ["[0]" list] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] [///// ["//" phase] [meta diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 54592b36b..39dc0ac97 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -24,9 +24,6 @@ ["[0]" array] ["[0]" dictionary (.only Dictionary)] ["[0]" sequence]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] @@ -34,6 +31,9 @@ ["[0]" meta (.only) ["[0]" code ["<[1]>" \\parser (.only Parser)]] + [macro + ["^" pattern] + ["[0]" template]] ["[0]" type (.only) ["[0]" check (.only Check) (.use "[1]#[0]" monad)]]] [target 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 a9932f619..367240a34 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 @@ -14,14 +14,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] [meta ["[0]" code ["<[1]>" \\parser (.only Parser)]] + [macro + ["^" pattern]] [type ["[0]" check]]] ["[0]" meta]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux index 9f74950cb..8cb1f6b1c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -21,16 +21,16 @@ ["[0]" dictionary] ["[0]" sequence] ["[0]" set (.only Set)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] ["[0]" i32]]] [meta ["[0]" code - ["<[1]>" \\parser (.only Parser)]]] + ["<[1]>" \\parser (.only Parser)]] + [macro + ["^" pattern] + ["[0]" template]]] [target [jvm ["_" bytecode (.only Bytecode) (.use "[1]#[0]" monad)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux index 8b50853ac..8c5f5dbc8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux @@ -20,14 +20,14 @@ ["[0]" array] ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set (.only Set)]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code - ["<[1]>" \\parser (.only Parser)]]] + ["<[1]>" \\parser (.only Parser)]] + [macro + ["^" pattern]]] ["[0]" type (.only sharing) (.use "[1]#[0]" equivalence) ["[0]" check]]]] ["[0]" /// (.only Extender) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index 150ff7dee..3205b9933 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -11,11 +11,12 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary]]] - [macro - ["^" pattern]] [math [number ["f" frac]]] + [meta + [macro + ["^" pattern]]] ["@" target (.only) ["_" js (.only Literal Expression Statement)]]]] ["[0]" //// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index 13662d1c3..b72b69b2c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -19,13 +19,14 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" set (.only Set)] ["[0]" sequence]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] ["[0]" i32]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]] [target [jvm ["[0]" version] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index 560f6c1ae..abaf8d32f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -14,11 +14,12 @@ [collection ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math [number ["f" frac]]] + [meta + [macro + ["^" pattern]]] ["@" target (.only) ["_" lua (.only Expression Statement)]]]] ["[0]" //// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index f36712cd4..37ac2d627 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -14,11 +14,12 @@ [collection ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math [number ["f" frac]]] + [meta + [macro + ["^" pattern]]] [target ["_" python (.only Expression Statement)]]]] ["[0]" //// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index a9681db10..95b08bf3c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -14,11 +14,12 @@ [collection ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math [number ["f" frac]]] + [meta + [macro + ["^" pattern]]] [target ["_" ruby (.only Expression Statement)]]]] ["[0]" //// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux index 9087341e0..8af11bb77 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux @@ -3,8 +3,9 @@ [lux (.except) [abstract [monad (.only do)]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" / [runtime (.only Phase)] ["[1][0]" primitive] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux index a839ca4ba..6059eddc2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux @@ -9,11 +9,12 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] + [meta + [macro + ["^" pattern]]] [target ["_" common_lisp (.only Expression Var/1)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 434d214e0..a945e79be 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -14,14 +14,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor monoid)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target ["_" common_lisp (.only Expression Computation Literal)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux index 0ccc9cbd3..9ab55a0a6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux @@ -6,11 +6,11 @@ [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] - ["[0]" macro (.only with_symbols) - [syntax (.only syntax)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)]]]]] ["[0]" /// ["[1][0]" extension] [// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux index 4c6b002c2..907159f8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux @@ -5,8 +5,9 @@ [monad (.only do)]] [control ["[0]" exception (.only exception)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" js]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index ce5b1a3f8..24e27bd78 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -9,11 +9,12 @@ ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] + [meta + [macro + ["^" pattern]]] [target ["_" js (.only Expression Computation Var Statement)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 75762cc34..da52044a7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -15,14 +15,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [target ["_" js (.only Expression Var Computation Statement)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux index e5994dc9f..8b5ee06f9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux @@ -3,8 +3,9 @@ [lux (.except) [abstract [monad (.only do)]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" / [runtime (.only Phase)] ["[1][0]" primitive] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index ad49fa9e5..bc03aae26 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -10,12 +10,13 @@ ["[0]" list (.use "[1]#[0]" mix)]] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["[0]" i32]]] + [meta + [macro + ["^" pattern]]] [target [jvm ["_" bytecode (.only Label Bytecode) (.use "[1]#[0]" monad) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux index ad9b0e720..100d864ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux @@ -6,11 +6,12 @@ [monad (.only do)]] [control ["[0]" try]] - [macro - ["^" pattern]] [math [number ["i" int]]] + [meta + [macro + ["^" pattern]]] [target [jvm ["_" bytecode (.only Bytecode)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux index e3929c22c..6971e4cfa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux @@ -5,8 +5,9 @@ [monad (.only do)]] [control ["[0]" exception (.only exception)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" lua]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 5d87b83d7..ea8ca09f0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -9,8 +9,9 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" lua (.only Expression Var Statement)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index 0d3d0f783..7d2fff7cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -15,14 +15,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" lua (.only Expression Location Var Computation Literal Label Statement)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux index 030565284..e96ac884a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux @@ -5,8 +5,9 @@ [monad (.only do)]] [control ["[0]" exception (.only exception)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" php]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 2b015ee7f..39ae8fcd4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -10,11 +10,12 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number ["i" int]]] + [meta + [macro + ["^" pattern]]] [target ["_" php (.only Expression Var Statement)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index 2e525be79..755efeded 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -15,14 +15,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" php (.only Expression Label Constant Var Computation Literal Statement)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux index f88b023c8..a5435e72d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux @@ -5,8 +5,9 @@ [monad (.only do)]] [control ["[0]" exception (.only exception)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" python]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index b79dc468b..5062e41ae 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -9,12 +9,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["i" int]]] + [meta + [macro + ["^" pattern]]] [target ["_" python (.only Expression SVar Statement)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 19c967248..b90fd1962 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -15,8 +15,6 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["f" frac] @@ -24,7 +22,9 @@ ["[0]" meta (.only) ["[0]" version] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" python (.only Expression SVar Computation Literal Statement)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux index cb2ccd087..135f3e4df 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux @@ -3,8 +3,9 @@ [lux (.except) [abstract [monad (.only do)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" r]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index ac0a29c7e..51cb787a3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -10,12 +10,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["i" int]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]] [target ["_" r (.only Expression SVar)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 49dfb21af..47cc25566 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -15,8 +15,6 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["n" nat] @@ -24,7 +22,9 @@ ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" r (.only SVar Expression)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux index f46905815..989d07127 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux @@ -5,8 +5,9 @@ [monad (.only do)]] [control ["[0]" exception (.only exception)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" ruby]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 8e22cf563..68c958870 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -9,12 +9,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["i" int]]] + [meta + [macro + ["^" pattern]]] [target ["_" ruby (.only Expression LVar Statement)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index 6684e6a59..32eb33c53 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -15,15 +15,15 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64] ["[0]" int (.use "[1]#[0]" interval)]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" ruby (.only Expression LVar Computation Literal Statement)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux index 35c505b59..24b418ffa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux @@ -3,8 +3,9 @@ [lux (.except) [abstract [monad (.only do)]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [target ["_" scheme]]]] ["[0]" / diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index 5f07b07e7..b9546d729 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -10,12 +10,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["i" int]]] + [meta + [macro + ["^" pattern] + ["[0]" template]]] [target ["_" scheme (.only Expression Computation Var)]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index cbf99339c..80d6b5111 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -11,11 +11,11 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["dict" dictionary (.only Dictionary)]]] - ["[0]" macro (.only with_symbols) - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only with_symbols) + [syntax (.only syntax)]]] [target ["_" scheme (.only Expression Computation)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index 1bf3f72eb..a54248283 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -15,14 +15,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" sequence]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex) ["[0]" i64]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] ["@" target (.only) ["_" scheme (.only Expression Computation Var)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux index 69c424b5b..3aa00a192 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -10,8 +10,9 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" / ["[1][0]" function] ["[1][0]" case] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 507e0b5fa..b2e0d357d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -13,13 +13,14 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" set (.only Set)]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["[0]" i64] - ["[0]" frac]]]]] + ["[0]" frac]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" /// [// ["[1][0]" analysis (.only Match Analysis) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux index e58b8f6fd..f1bf10c2c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -13,11 +13,12 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor monoid)]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // ["[1][0]" loop (.only Transform)] ["//[1]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 42d9ed6ae..eb5738a11 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -8,11 +8,12 @@ [data [collection ["[0]" list]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [//// ["[0]" analysis (.only Environment) ["[1]/[0]" complex]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 7f2be3cf5..80fce0c79 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -15,11 +15,12 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [//// ["[0]" analysis (.only) ["[1]/[0]" complex]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index cba888c44..e5304ee2e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -41,13 +41,13 @@ [collection ["[0]" list] ["[0]" dictionary (.only Dictionary)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [meta ["[0]" symbol] ["[0]" code - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index 03fd9d860..735da0f51 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -16,14 +16,15 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]] [math [number ["[0]" i64] ["n" nat] ["i" int] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" / ["[1][0]" simple (.only Simple)] ["[1][0]" access (.only Access) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux index 32a921934..738ea9b76 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux @@ -10,14 +10,15 @@ ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]]] - [macro - ["^" pattern]] [math [number ["[0]" i64 (.use "[1]#[0]" equivalence)] ["n" nat] ["i" int] - ["f" frac]]]]]) + ["f" frac]]] + [meta + [macro + ["^" pattern]]]]]) (type .public Simple (Variant diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux index 665894617..706ea16ae 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux @@ -8,11 +8,12 @@ [data ["[0]" product] ["[0]" text (.use "[1]#[0]" equivalence)]] - [macro - ["^" pattern]] [math [number - ["[0]" nat]]]]] + ["[0]" nat]]] + [meta + [macro + ["^" pattern]]]]] [///// [arity (.only Arity)]]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux index b3e186b92..057f72e6e 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux @@ -13,11 +13,12 @@ ["<[1]>" \\parser (.only Parser)]] [collection ["[0]" set (.only Set)]]] - [macro - ["^" pattern]] [math [number ["[0]" nat]]] + [meta + [macro + ["^" pattern]]] [world [file (.only Path)]]]]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index b7c1e2e35..fa6493f90 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -20,9 +20,9 @@ ["[0]" list] ["[0]" sequence (.only Sequence) (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]] [meta + [macro + ["^" pattern]] [type [primitive (.except)]]]]] ["[0]" // diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux index 11fa0a54f..d3e19193c 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux @@ -12,13 +12,13 @@ ["[0]" set (.only Set)] ["[0]" dictionary (.only Dictionary)] ["[0]" sequence]]] - [macro - ["^" pattern]] [math [number ["[0]" nat]]] [meta - ["[0]" symbol]] + ["[0]" symbol] + [macro + ["^" pattern]]] [tool [compiler ["[0]" phase] diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux index caeb07961..2f2aa0f92 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux @@ -14,13 +14,13 @@ ["<[1]>" \\parser]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern]] [math [number (.only hex)]] [meta ["[0]" symbol] - ["[0]" configuration (.only Configuration)]] + ["[0]" configuration (.only Configuration)] + [macro + ["^" pattern]]] ["[0]" program ["<[1]>" \\parser (.only Parser)]] [tool 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 3a89e09eb..032eaaf66 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -20,11 +20,11 @@ ["[0]" list (.use "[1]#[0]" mix)] ["[0]" dictionary (.only Dictionary)] ["[0]" sequence (.only Sequence)]]] - [macro - ["^" pattern]] [meta ["[0]" configuration (.only Configuration)] - ["[0]" version]] + ["[0]" version] + [macro + ["^" pattern]]] [world ["[0]" file]]]] ["[0]" // (.only) diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux index c4a64ae2e..340cf1a0d 100644 --- a/stdlib/source/library/lux/tool/compiler/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/reference.lux @@ -9,13 +9,13 @@ [data [text ["%" \\format (.only Format)]]] - [macro - ["^" pattern]] [math [number ["n" nat]]] [meta - ["[0]" symbol]]]] + ["[0]" symbol] + [macro + ["^" pattern]]]]] ["[0]" / ["[1][0]" variable (.only Variable)]]) diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux index 30f7b449d..852a1e058 100644 --- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux @@ -9,12 +9,13 @@ [data [text ["%" \\format (.only Format)]]] - [macro - ["^" pattern]] [math [number ["n" nat] - ["i" int]]]]]) + ["i" int]]] + [meta + [macro + ["^" pattern]]]]]) (type .public Register Nat) diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index 71ffeb1db..955335715 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -1,12 +1,14 @@ (.require [library [lux (.except and int) + [fii (.only import)] [control [functor (.only Functor)] [apply (.only Apply)] [monad (.only Monad do)] - ["[0]" try (.only Try)] ["ex" exception] + ["[0]" try (.only Try)] + ["[0]" io (.only IO)] [concurrency ["[0]" async (.only Async) (.use "[1]#[0]" monad)]] [security @@ -15,10 +17,8 @@ ["[0]" product] [text ["%" \\format (.only format)]]] - ["[0]" io (.only IO)] [world - [net (.only URL)]] - [host (.only import)]]] + [net (.only URL)]]]] [// ["[0]" sql]] ["[0]" / diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux index 94a0b399e..fb8f9b3e3 100644 --- a/stdlib/source/library/lux/world/db/jdbc/input.lux +++ b/stdlib/source/library/lux/world/db/jdbc/input.lux @@ -5,10 +5,10 @@ [control [functor (.only Contravariant)] [monad (.only Monad do)] - ["[0]" try (.only Try)]] + ["[0]" try (.only Try)] + ["[0]" io (.only IO)]] [time ["[0]" instant (.only Instant)]] - ["[0]" io (.only IO)] [world [binary (.only Binary)]]]]) diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux index 809015e50..6a9181636 100644 --- a/stdlib/source/library/lux/world/db/jdbc/output.lux +++ b/stdlib/source/library/lux/world/db/jdbc/output.lux @@ -7,10 +7,10 @@ [apply (.only Apply)] [monad (.only Monad do)] ["ex" exception] - ["[0]" try (.only Try)]] + ["[0]" try (.only Try)] + ["[0]" io (.only IO)]] [time ["[0]" instant (.only Instant)]] - ["[0]" io (.only IO)] [world [binary (.only Binary)]]]]) diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 834e43081..70312b648 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -10,8 +10,9 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] + [meta + [macro + ["[0]" template]]] [type [primitive (.except)]]]]) diff --git a/stdlib/source/library/lux/world/environment.lux b/stdlib/source/library/lux/world/environment.lux index dc055f98d..ce76fc208 100644 --- a/stdlib/source/library/lux/world/environment.lux +++ b/stdlib/source/library/lux/world/environment.lux @@ -25,11 +25,12 @@ (.,, (.for "JavaScript" (.,, (.these ["[0]" node_js])) "{old}" (.,, (.these ["node_js" //math])) (.,, (.these))))] - ["[0]" macro (.only) - ["[0]" template]] [math [number - ["i" int]]]]] + ["i" int]]] + [meta + ["[0]" macro (.only) + ["[0]" template]]]]] ["[0]" \\parser] [// [file (.only Path)] diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 3b768f0a1..303782ac7 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -28,12 +28,13 @@ (.,, (.for "JavaScript" (.,, (.these ["[0]" node_js])) "{old}" (.,, (.these ["node_js" //control/thread])) (.,, (.these))))] - [macro - ["[0]" template]] [math [number ["i" int] ["f" frac]]] + [meta + [macro + ["[0]" template]]] [time ["[0]" instant (.only Instant)] ["[0]" duration]]]]))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 3cc84fdcf..6a999716d 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -17,16 +17,16 @@ ["[0]" text] [collection ["[0]" dictionary]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math [number ["n" nat] ["i" int]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]]]]] ["[0]" // (.only) [// (.only URL)]]) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index e4c1eebb9..fdf8a8aa1 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -21,8 +21,9 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary]]] - [macro - ["^" pattern]] + [meta + [macro + ["^" pattern]]] [world ["[0]" binary (.only Binary)]]]] ["[0]" // (.only Body Response Server) diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux index 68e9fe674..7b223efed 100644 --- a/stdlib/source/library/lux/world/net/http/response.lux +++ b/stdlib/source/library/lux/world/net/http/response.lux @@ -2,6 +2,7 @@ [library [lux (.except static) [control + ["[0]" io] [concurrency ["[0]" async] ["[0]" frp (.use "[1]#[0]" monad)]]] @@ -13,7 +14,6 @@ ["[0]" css (.only CSS)] ["[0]" context] ["[0]" json (.only JSON) (.use "[1]#[0]" codec)]]] - ["[0]" io] [world ["[0]" binary (.only Binary)]]]] ["[0]" // (.only Status Body Response Server) diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux index e4454432e..53d533334 100644 --- a/stdlib/source/library/lux/world/net/http/route.lux +++ b/stdlib/source/library/lux/world/net/http/route.lux @@ -10,8 +10,9 @@ ["[0]" text] [number ["n" nat]]] - [macro - ["^" pattern]]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" // (.only URI Server) ["[1][0]" status] ["[1][0]" response]]) diff --git a/stdlib/source/parser/lux/data/binary.lux b/stdlib/source/parser/lux/data/binary.lux index 5cb5e0e93..8cd81ed6d 100644 --- a/stdlib/source/parser/lux/data/binary.lux +++ b/stdlib/source/parser/lux/data/binary.lux @@ -22,15 +22,15 @@ ["[0]" set (.only Set)] [array [\\unsafe (.only)]]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat] ["[0]" frac]]] [meta - [type (.only sharing)]]]]) + [type (.only sharing)] + [macro + ["^" pattern] + ["[0]" template]]]]]) (.type .public Offset Nat) diff --git a/stdlib/source/parser/lux/data/text.lux b/stdlib/source/parser/lux/data/text.lux index a85ef474a..31a12ed16 100644 --- a/stdlib/source/parser/lux/data/text.lux +++ b/stdlib/source/parser/lux/data/text.lux @@ -13,14 +13,14 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" mix)]]] - [macro - ["^" pattern] - ["[0]" template]] [math [number ["n" nat (.use "[1]#[0]" decimal)]]] [meta - ["[0]" code]]]]) + ["[0]" code] + [macro + ["^" pattern] + ["[0]" template]]]]]) (type .public Offset Nat) diff --git a/stdlib/source/parser/lux/meta/type.lux b/stdlib/source/parser/lux/meta/type.lux index f1acda29d..2b03a75e1 100644 --- a/stdlib/source/parser/lux/meta/type.lux +++ b/stdlib/source/parser/lux/meta/type.lux @@ -14,13 +14,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]] [math [number ["n" nat (.use "[1]#[0]" decimal)]]] [meta - ["[0]" code]]]] + ["[0]" code] + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.use "[1]#[0]" equivalence) ["[0]" check]]]) diff --git a/stdlib/source/parser/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/parser/lux/tool/compiler/language/lux/analysis.lux index 32ee998eb..7c7e8b855 100644 --- a/stdlib/source/parser/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/parser/lux/tool/compiler/language/lux/analysis.lux @@ -13,8 +13,6 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math [number ["[0]" i64] @@ -23,7 +21,9 @@ ["[0]" rev] ["[0]" frac]]] [meta - ["[0]" symbol]] + ["[0]" symbol] + [macro + ["[0]" template]]] [tool [compiler [arity (.only Arity)] diff --git a/stdlib/source/polytypic/lux/abstract/equivalence.lux b/stdlib/source/polytypic/lux/abstract/equivalence.lux index bc044fe6b..50d04c8e0 100644 --- a/stdlib/source/polytypic/lux/abstract/equivalence.lux +++ b/stdlib/source/polytypic/lux/abstract/equivalence.lux @@ -25,18 +25,18 @@ ["[0]" int] ["[0]" rev] ["[0]" frac]]] - [time - ["[0]" duration] - ["[0]" date] - ["[0]" instant] - ["[0]" day] - ["[0]" month]] [meta ["[0]" code] ["[0]" type (.only) ["<[1]>" \\parser] ["[0]" poly (.only polytypic)] - ["[0]" unit]]]]] + ["[0]" unit]]] + [time + ["[0]" duration] + ["[0]" date] + ["[0]" instant] + ["[0]" day] + ["[0]" month]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/polytypic/lux/data/format/json.lux b/stdlib/source/polytypic/lux/data/format/json.lux index 5f79d7fe4..cae0194d4 100644 --- a/stdlib/source/polytypic/lux/data/format/json.lux +++ b/stdlib/source/polytypic/lux/data/format/json.lux @@ -17,27 +17,27 @@ ["[0]" list (.use "[1]#[0]" monad)] ["[0]" sequence (.only sequence)] ["[0]" dictionary]]] - [macro - [syntax (.only syntax)]] [math [number ["n" nat (.use "[1]#[0]" decimal)] ["[0]" i64] ["[0]" int] ["[0]" frac]]] - [time - ... ["[0]" instant] - ... ["[0]" duration] - ["[0]" date] - ["[0]" day] - ["[0]" month]] [meta ["[0]" code (.only) ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]] ["[0]" type (.only) ["<[1]>" \\parser] ["[0]" unit] - ["[0]" poly (.only polytypic)]]]]] + ["[0]" poly (.only polytypic)]]] + [time + ... ["[0]" instant] + ... ["[0]" duration] + ["[0]" date] + ["[0]" day] + ["[0]" month]]]] [\\library ["[0]" / (.only JSON)]]) diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux index 08fb2d4b7..42bbc6a4f 100644 --- a/stdlib/source/program/aedifex/artifact/extension.lux +++ b/stdlib/source/program/aedifex/artifact/extension.lux @@ -4,8 +4,9 @@ [data ["[0]" text (.only) ["%" \\format (.only format)]]] - [macro - ["[0]" template]]]] + [meta + [macro + ["[0]" template]]]]] ["[0]" // ["[1]" type]]) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 69b5f9e40..38738e400 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -19,14 +19,14 @@ ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)] ["[0]" set]]] - [macro - ["^" pattern]] [math [number (.only hex) ["n" nat] ["i" int]]] [meta - ["[0]" configuration]] + ["[0]" configuration] + [macro + ["^" pattern]]] [tool [compiler [meta diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 21155222d..7acc3e8c9 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -10,11 +10,12 @@ [data [collection ["[0]" dictionary]]] - [macro - ["^" pattern]] [math [number ["i" int]]] + [meta + [macro + ["^" pattern]]] [world ["[0]" program (.only Program)] ["[0]" file] diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 5ba5ab385..da65aa330 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -7,9 +7,10 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" list (.use "[1]#[0]" monad)] ["[0]" set (.only Set)]]] - [macro - ["[0]" code] - ["[0]" template]] + [meta + [macro + ["[0]" code] + ["[0]" template]]] [tool [compiler [meta diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 3f7376286..1c853512c 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -14,14 +14,15 @@ ["[0]" text ["%" \\format (.only Format format)] ["[0]" encoding]]] - [macro - ["^" pattern]] [math [number ["n" nat] ["[0]" i64]]] - [type - [primitive (.except)]]]]) + [meta + [macro + ["^" pattern]] + [type + [primitive (.except)]]]]]) ... TODO: Replace with pure-Lux implementations of these algorithms ... https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 5f9435dd5..060bc0f18 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -15,11 +15,11 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" list (.use "[1]#[0]" monoid) ["[0]" property (.use "[1]#[0]" monoid)]]]] - [macro - ["^" pattern] - ["[0]" template]] [meta - ["[0]" symbol]] + ["[0]" symbol] + [macro + ["^" pattern] + ["[0]" template]]] [world [net (.only URL)] [file (.only Path)]] diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index 981ca9b12..20d270008 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -10,8 +10,9 @@ [collection ["[0]" list (.use "[1]#[0]" monoid)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["[0]" template]] + [meta + [macro + ["[0]" template]]] [world ["[0]" file]]]]) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 0a29b79b7..354a1198f 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except Module) - [type (.only sharing)] ["@" target] ["[0]" debug] [abstract @@ -19,6 +18,8 @@ ["%" \\format (.only format)]] [collection ["[0]" dictionary (.only Dictionary)]]] + [meta + [type (.only sharing)]] [time ["[0]" instant]] ["[0]" world diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 8c3545262..fd517a5dd 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -17,10 +17,11 @@ ["%" \\format (.only format)]] [collection ["[0]" list]]] - [macro - ["^" pattern]] [math ["r" random (.only Random)]] + [meta + [macro + ["^" pattern]]] [tool [compiler ["[0]" reference] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 1e997b2cf..1452a1aed 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -21,10 +21,6 @@ ["[0]" set (.only Set) (.use "[1]#[0]" equivalence)] ["[0]" list (.use "[1]#[0]" functor) ["[0]" property]]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["^" pattern] - ["[0]" template]] ["[0]" math ["[0]" random (.use "[1]#[0]" functor)] [number @@ -38,7 +34,11 @@ ["[0]" meta (.use "[1]#[0]" monad) ["[0]" location (.use "[1]#[0]" equivalence)] ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" template]]]]] ... TODO: Must have 100% coverage on tests. ["[0]" / ["[1][0]" abstract] @@ -48,7 +48,6 @@ ["[1][0]" documentation] ["[1][0]" locale] - ["[1][0]" macro] ["[1][0]" math] ["[1][0]" meta] @@ -1213,7 +1212,6 @@ /documentation.test /locale.test - /macro.test /math.test /meta.test diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 7634e19fe..542175167 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -7,15 +7,16 @@ [data ["[0]" sum] ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat] ["i" int] ["r" rev] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only =>)]]) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index ed8410fa1..1a310744f 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -12,13 +12,14 @@ [collection ["[0]" dictionary (.only Dictionary)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random] [number ["n" nat] ["[0]" i64]]] + [meta + [macro + ["^" pattern]]] [time ["[0]" instant] ["[0]" duration (.only Duration)]]]] diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 3ed034a69..edc355e23 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -15,12 +15,13 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 6cecb66d4..2a7139b86 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -20,11 +20,11 @@ ["[0]" random] [number ["n" nat]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only Parser)]]) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 17440088a..9f79123c1 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -15,11 +15,11 @@ [math [number (.only hex)] ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] - ["[0]" macro (.only) - ["[0]" syntax (.only syntax)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + ["[0]" syntax (.only syntax)]]] [time ["[0]" date (.only Date)] ["[0]" instant] diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 1cfbf5c9e..7e0de2086 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -11,12 +11,13 @@ ["$[0]" monad]]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] - [macro - ["^" pattern]] [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only Context Privacy Can_Conceal Can_Reveal Privilege Private)]]) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index d3fcc968a..c43caf3a4 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -31,8 +31,6 @@ ["[0]" set] [array [\\unsafe (.only)]]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number @@ -42,9 +40,11 @@ ["[0]" rev] ["[0]" frac]]] [meta - ["[0]" code] ["[0]" symbol] - ["[0]" type]]]] + ["[0]" type] + ["[0]" code] + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) (.use "[1]#[0]" equivalence) ["!" \\unsafe] diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index aec7a93e5..3f560f85d 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -16,12 +16,13 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" / (.only Tree) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index d98340a31..5bb0ca32b 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -8,12 +8,13 @@ [collection ["[0]" list] ["[0]" set]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index bfc2b7d89..0e7ec6b44 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -27,9 +27,6 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" set] ["[0]" list (.use "[1]#[0]" functor)]]] - ["[0]" macro (.only) - ["^" pattern] - ["[0]" syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number @@ -43,6 +40,9 @@ ["[0]/[1]" \\test]]] ["[0]" meta (.only) ["[0]" code] + ["[0]" macro (.only) + ["^" pattern] + ["[0]" syntax (.only syntax)]] [type ["[0]" unit]]]]] ["[0]" \\polytypic] diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 4a4426fd9..817c38c5a 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -24,14 +24,14 @@ [collection ["[0]" sequence] ["[0]" list (.use "[1]#[0]" mix)]]] - [time - ["[0]" instant (.only Instant)] - ["[0]" duration]] [math ["[0]" random (.only Random)] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + [time + ["[0]" instant (.only Instant)] + ["[0]" duration]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index dfdc7ac0e..72a4a5665 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -18,16 +18,16 @@ [collection ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern] - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] - ["[0]" type (.use "[1]#[0]" equivalence)]]]] + ["[0]" type (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern] + ["[0]" template]]]]] ["[0]" \\parser] [\\library ["[0]" / (.use "[1]#[0]" equivalence)]]) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index ef8bf11ec..82d998311 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -33,8 +33,6 @@ ["[0]" unicode ["[1]" set] ["[1]/[0]" block]]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] ["[0]" modulus] @@ -50,7 +48,9 @@ ["[0]" symbol] ["[0]" type] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + ["^" pattern]]] ["[0]" time (.only) ["[0]" day] ["[0]" month] diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 47a1ddbb7..7464a5934 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -14,12 +14,13 @@ [collection ["[0]" list (.use "[1]#[0]" mix)] ["[0]" set]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index da90e8f24..7509dcf58 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -14,16 +14,16 @@ ["%" \\format (.only format)]] [collection ["[0]" set (.only Set)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math ["[0]" random (.only Random)] [number (.only hex) ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" / (.only) [// diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 5dabc0a9b..faadefa50 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -11,14 +11,14 @@ ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)] ["<[1]>" \\parser (.only Parser)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex)] ["[0]" random]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 7149a441c..34f1ab7cd 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -13,12 +13,13 @@ [collection ["[0]" set] ["[0]" list]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number (.only hex) - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index cda9456f2..5214ede51 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -16,15 +16,15 @@ [format [json (.only JSON)] [xml (.only XML)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number [ratio (.only Ratio)]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [time (.only Time) [instant (.only Instant)] [date (.only Date)] diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 9a22ca625..37aff4544 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -10,12 +10,12 @@ ["%" \\format]] [format ["md" markdown]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index a50ff37ac..1ee8a623a 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -30,15 +30,15 @@ [collection ["[0]" sequence] ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat]]] [meta ["[0]" code - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + ["[0]" template]]] [tool [compiler ["[0]" phase] diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 642075157..55ca861be 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -17,9 +17,6 @@ ["%" \\format (.only format)]] [collection ["[0]" array (.only Array)]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) @@ -30,7 +27,10 @@ ["[0]" meta (.only) ["[0]" type (.use "[1]#[0]" equivalence)] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]] [target ["[0]" jvm ["[1]" type (.use "[1]#[0]" equivalence)]]]]] diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index b8d9ea20a..a5beca2bb 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -10,15 +10,16 @@ [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat] ["i" int] ["f" frac]]] - ["[0]" type (.use "[1]#[0]" equivalence)]]] + [meta + ["[0]" type (.use "[1]#[0]" equivalence)] + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/ffi/export.jvm.lux b/stdlib/source/test/lux/ffi/export.jvm.lux index a567e8df4..81615af21 100644 --- a/stdlib/source/test/lux/ffi/export.jvm.lux +++ b/stdlib/source/test/lux/ffi/export.jvm.lux @@ -10,8 +10,6 @@ ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) @@ -19,7 +17,9 @@ ["[0]" int (.use "[1]#[0]" equivalence)] ["[0]" frac (.use "[1]#[0]" equivalence)]]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 4c4f2d62e..edabb90d2 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -14,12 +14,13 @@ [collection ["[0]" set (.only Set)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 514009dc0..969fe32a1 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -14,12 +14,13 @@ [collection ["[0]" set (.only Set)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux deleted file mode 100644 index 948acd4cd..000000000 --- a/stdlib/source/test/lux/macro.lux +++ /dev/null @@ -1,250 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - ["[0]" static] - [abstract - [monad (.only do)]] - [control - ["[0]" try (.use "[1]#[0]" functor)]] - [data - ["[0]" bit (.use "[1]#[0]" equivalence)] - ["[0]" text (.only) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]] - [macro - ["^" pattern]] - [math - ["[0]" random (.only Random) (.use "[1]#[0]" functor)] - [number - ["n" nat]]] - ["[0]" meta (.only) - ["[0]" location] - ["[0]" symbol] - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" / (.only) - [syntax (.only syntax)] - ["[0]" template]]] - ["[0]" / - ["[1][0]" local] - ["[1][0]" syntax] - ["[1][0]" template] - ["[1][0]" pattern] - ["[1][0]" context]]) - -(def !expect - (template (_ ) - [(case - true - _ false)])) - -(def !global - (template (_ ) - [(is [Text .Global] - [(template.text []) {.#Definition [true .Macro ]}])])) - -(def pow/2 - (syntax (_ [number .any]) - (in (list (` (n.* (, number) (, number))))))) - -(def pow/4 - (syntax (_ [number .any]) - (in (list (` (..pow/2 (..pow/2 (, number)))))))) - -(def repeated - (syntax (_ [times .nat - token .any]) - (in (list.repeated times token)))) - -(def fresh_symbol - (syntax (_ []) - (do meta.monad - [g!fresh (/.symbol "fresh")] - (in (list g!fresh))))) - -(def random_lux - (Random [Nat Text .Lux]) - (do [! random.monad] - [seed random.nat - symbol_prefix (random.upper_case 1) - .let [macro_module (symbol.module (symbol /._)) - current_module (symbol.module (symbol .._))]] - (in [seed - symbol_prefix - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some current_module} - .#modules (list [macro_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (is (List [Text .Global]) - (list (!global /.log_single_expansion!) - (!global /.log_expansion!) - (!global /.log_full_expansion!))) - .#imports (list) - .#module_state {.#Active}]] - [current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (is (List [Text .Global]) - (list (!global ..pow/2) - (!global ..pow/4) - (!global ..repeated))) - .#imports (list) - .#module_state {.#Active}]]) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed seed - .#scope_type_vars (list) - .#extensions [] - .#eval (as (-> Type Code (Meta Any)) []) - .#host []]]))) - -(def iterated - (syntax (_ [cycle .nat - it .any]) - (in (list (case cycle - 0 it - _ (` (..iterated (, (code.nat (-- cycle))) (, it)))))))) - -(def test|expansion - Test - (do [! random.monad] - [[seed symbol_prefix lux] ..random_lux - - pow/1 (at ! each code.nat random.nat) - - repetitions (at ! each (n.% 10) random.nat) - .let [single_expansion (` (..pow/2 (..pow/2 (, pow/1)))) - expansion (` (n.* (..pow/2 (, pow/1)) - (..pow/2 (, pow/1)))) - full_expansion (` (n.* (n.* (, pow/1) (, pow/1)) - (n.* (, pow/1) (, pow/1))))]] - (`` (all _.and - (,, (with_template [ ] - [(_.coverage [] - (|> ( (` (..pow/4 (, pow/1)))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = - (list ))) - (try.else false))) - - (_.coverage [] - (and (|> (/.single_expansion (` ( "omit" (..pow/4 (, pow/1))))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = (list))) - (try.else false)) - (|> (/.single_expansion (` ( (..pow/4 (, pow/1))))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = (list ))) - (try.else false))))] - - [/.single_expansion /.log_single_expansion! single_expansion] - [/.expansion /.log_expansion! expansion] - [/.full_expansion /.log_full_expansion! full_expansion] - )) - (_.coverage [/.one_expansion] - (bit#= (not (n.= 1 repetitions)) - (|> (/.one_expansion (` (..repeated (, (code.nat repetitions)) (, pow/1)))) - (meta.result lux) - (!expect {try.#Failure _})))) - (_.coverage [/.final] - (with_expansions [ (static.random_nat) - (static.random code.nat - (random#each (|>> (n.% 5) ++) random.nat)) - (/.final (..iterated ))] - (case (' ) - [_ {.#Nat actual}] - (n.= actual) - - _ - false))) - (_.coverage [/.times] - (with_expansions [ (static.random_nat) - (static.random code.nat - (random#each (|>> (n.% 10) (n.+ 2)) random.nat)) - (static.random code.nat - (random#each (|>> (n.% ) ++) random.nat)) - (/.times (..iterated ))] - (let [expected_remaining (n.- )] - (case (` ) - (^.` (..iterated (, [_ {.#Nat actual_remaining}]) (, [_ {.#Nat actual}]))) - (and (n.= expected_remaining actual_remaining) - (n.= actual)) - - _ - false)))) - )))) - -(def sum - (macro (_ tokens) - (loop (again [tokens tokens - output 0]) - (case tokens - {.#End} - (at meta.monad in (list (code.nat output))) - - {.#Item [_ {.#Nat head}] tail} - (again tail (n.+ head output)) - - _ - (meta.failure ""))))) - -(def sum' - (macro (_ tokens lux) - ((/.function ..sum) tokens lux))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (do [! random.monad] - [[seed symbol_prefix lux] ..random_lux] - (all _.and - (_.coverage [/.symbol] - (|> (/.symbol symbol_prefix) - (at meta.monad each %.code) - (meta.result lux) - (!expect (^.multi {try.#Success actual_symbol} - (and (text.contains? symbol_prefix actual_symbol) - (text.contains? (%.nat seed) actual_symbol)))))) - (_.coverage [/.wrong_syntax_error] - (|> (/.single_expansion (` (/.log_single_expansion!))) - (meta.result lux) - (!expect (^.multi {try.#Failure error} - (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) - error))))) - (_.coverage [/.with_symbols] - (with_expansions [ (fresh_symbol)] - (|> (/.with_symbols [] - (at meta.monad in )) - (meta.result lux) - (!expect (^.multi {try.#Success [_ {.#Symbol ["" actual]}]} - (text.contains? (template.text []) - actual)))))) - (_.coverage [/.function] - (with_expansions [n/0 (static.random_nat) - n/1 (static.random_nat) - n/1 (static.random_nat)] - (n.= (..sum n/0 n/1 n/1) - (..sum' n/0 n/1 n/1)))) - )) - - ..test|expansion - - /local.test - /syntax.test - /template.test - /pattern.test - /context.test - ))) diff --git a/stdlib/source/test/lux/macro/context.lux b/stdlib/source/test/lux/macro/context.lux deleted file mode 100644 index 52df97710..000000000 --- a/stdlib/source/test/lux/macro/context.lux +++ /dev/null @@ -1,12 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)]]] - [\\library - ["[0]" /]]) - -(def .public test - Test - (<| (_.covering /._) - (_.property "TBD" false) - )) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux deleted file mode 100644 index 75b8b68ca..000000000 --- a/stdlib/source/test/lux/macro/local.lux +++ /dev/null @@ -1,130 +0,0 @@ -(.require - [library - [lux (.except with) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["<>" parser] - ["[0]" try] - ["[0]" exception]] - [data - [text - ["%" \\format]] - [collection - ["[0]" list - ["[0]" property]]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - ["[0]" meta (.only) - ["[0]" code (.only) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(/.let [!pow/2 (template (_ ) - [(n.* )])] - (def pow/2 - (-> Nat Nat) - (|>> !pow/2))) - -(def macro_error - (syntax (_ [macro .any]) - (function (_ compiler) - (case ((macro.expansion macro) compiler) - {try.#Failure error} - {try.#Success [compiler (list (code.text error))]} - - {try.#Success _} - {try.#Failure "OOPS!"})))) - -(def (constant output) - (-> Code Macro) - ("lux macro" - (function (_ inputs lux) - {try.#Success [lux (list output)]}))) - -(def with - (syntax (_ [name (.tuple (<>.and .text .text)) - constant .any - pre_remove .bit - body .any]) - (macro.with_symbols [g!output] - (do meta.monad - [pop! (/.push (list [name (..constant constant)])) - [module short] (meta.normal name) - _ (if pre_remove - (let [remove_macro! (is (-> .Module .Module) - (revised .#definitions (property.lacks short)))] - (function (_ lux) - {try.#Success [(revised .#modules (property.revised module remove_macro!) lux) - []]})) - (in []))] - (let [pre_expansion (` (let [(, g!output) (, body)] - (exec - (, pop!) - (, g!output))))] - (if pre_remove - (macro.full_expansion pre_expansion) - (in (list pre_expansion)))))))) - -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - [expected random.nat] - (all _.and - (_.coverage [/.push] - (..with ["" "actual"] expected #0 - (n.= expected (..actual)))) - (_.coverage [/.unknown_module] - (exception.match? /.unknown_module - (..macro_error - (..with ["123yolo456" "actual"] expected #0 - (n.= expected (..actual)))))) - (_.coverage [/.cannot_shadow_definition] - (exception.match? /.cannot_shadow_definition - (..macro_error - (..with ["" "with"] expected #0 - (n.= expected (..actual)))))) - (_.coverage [/.unknown_definition] - (exception.match? /.unknown_definition - (<| ..macro_error - (..with ["" "actual"] expected #1) - (n.= expected (..actual))))) - (do ! - [scalar random.nat] - (_.coverage [/.let] - (let [can_use_with_statements! - (n.= (all n.* scalar scalar) - (..pow/2 scalar))] - (and can_use_with_statements! - (/.let [pow/3 (template (_ ) - [(all n.* )]) - pow/9 (template (_ ) - [(pow/3 (pow/3 ))])] - (let [can_use_with_expressions! - (n.= (all n.* scalar scalar scalar) - (pow/3 scalar)) - - can_refer! - (n.= (all n.* - scalar scalar scalar - scalar scalar scalar - scalar scalar scalar) - (pow/9 scalar)) - - can_shadow! - (let [pow/3 (function (_ scalar) - (all n.+ scalar scalar scalar))] - (n.= (all n.+ scalar scalar scalar) - (pow/3 scalar)))] - (and can_use_with_expressions! - can_refer! - can_shadow!))) - )))) - )))) diff --git a/stdlib/source/test/lux/macro/pattern.lux b/stdlib/source/test/lux/macro/pattern.lux deleted file mode 100644 index 7b9e161c1..000000000 --- a/stdlib/source/test/lux/macro/pattern.lux +++ /dev/null @@ -1,99 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [data - ["[0]" bit (.use "[1]#[0]" equivalence)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat] - ["i" int] - ["f" frac]]] - [meta - ["[0]" code]]]] - [\\library - ["[0]" /]]) - -(type (Pair l r) - (Record - [#left l - #right r])) - -(def !pair - (template (_ ) - [[..#left - ..#right ]])) - -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - [expected_nat (at ! each (n.% 1) random.nat) - expected_int (at ! each (i.% +1) random.int) - expected_rev (random.either (in .5) - (in .25)) - expected_frac (random.either (in +0.5) - (in +1.25)) - expected_text (random.either (in "+0.5") - (in "+1.25"))] - (all _.and - (do [! random.monad] - [sample (at ! each (n.% 5) random.nat)] - (_.coverage [/.with_template] - (case sample - (/.with_template [] - [ true]) - ([0] [1] [2] [3] [4]) - - _ - false))) - (_.coverage [/.or] - (and (/.case expected_rev - (/.or .5 .25) true - _ false) - (/.case expected_frac - (/.or +0.5 +1.25) true - _ false) - (/.case expected_text - (/.or "+0.5" "+1.25") true - _ false))) - (_.coverage [/.let] - (let [expected_pair (is (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (/.case expected_pair - (/.let actual_pair (/.pattern (!pair actual_left actual_right))) - (and (/.same? expected_pair actual_pair) - (/.same? expected_nat actual_left) - (/.same? expected_int actual_right))))) - (_.coverage [/.multi] - (let [expected_pair (is (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (and (/.case expected_pair - (/.multi (/.pattern (!pair 0 actual_right)) - [actual_right - +0]) - true - - _ - false) - (/.case expected_pair - (/.multi (/.pattern (!pair 0 actual_right)) - (i.= +0 actual_right)) - true - - _ - false)))) - (_.coverage [/.|>] - (case expected_frac - (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) - (f.= (f.* +4.0 expected_frac) - actual_frac))) - (_.coverage [/.`] - (case (code.text expected_text) - (/.` "+0.5") true - (/.` "+1.25") true - _ false)) - )))) diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux deleted file mode 100644 index 5c6b392f1..000000000 --- a/stdlib/source/test/lux/macro/syntax.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [math - ["[0]" random] - [number - ["n" nat]]] - [meta - ["[0]" code - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" check] - ["[1][0]" declaration] - ["[1][0]" definition] - ["[1][0]" export] - ["[1][0]" input] - ["[1][0]" type - ["[1]/[0]" variable]]]) - -(def +/3 - (/.syntax (_ [a .any - b .any - c .any]) - (in (list (` (all n.+ (, a) (, b) (, c))))))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (do random.monad - [x random.nat - y random.nat - z random.nat] - (_.coverage [/.syntax] - (n.= (all n.+ x y z) - (+/3 x y z)))) - - /check.test - /declaration.test - /definition.test - /export.test - /input.test - /type/variable.test - ))) diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux deleted file mode 100644 index 11fa981e6..000000000 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["<>" parser] - ["[0]" try]] - [math - ["[0]" random (.only Random)]] - [meta - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]" //// - [meta - ["[1][0]" code]]]) - -(def .public random - (Random /.Check) - (all random.and - $////code.random - $////code.random - )) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Check]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [[type value] ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser - (list (/.format [/.#type type - /.#value value]))) - {try.#Failure _} - false - - {try.#Success check} - (and (code#= type (the /.#type check)) - (code#= value (the /.#value check))))))))) diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux deleted file mode 100644 index d111576fc..000000000 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]]]] - [\\library - ["[0]" / (.only) - [//// - [meta - ["[0]" code - ["<[1]>" \\parser]]]]]]) - -(def .public random - (Random /.Declaration) - (let [word (random.alphabetic 10)] - (all random.and - word - (do [! random.monad] - [size (at ! each (n.% 10) random.nat)] - (random.list size word)) - ))) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Declaration]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser - (list (/.format expected))) - {try.#Failure _} - false - - {try.#Success actual} - (at /.equivalence = expected actual))))))) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux deleted file mode 100644 index 0ebf14286..000000000 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ /dev/null @@ -1,97 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["<>" parser] - ["[0]" try] - ["[0]" exception]] - [math - ["[0]" random (.only Random)]] - [meta - ["[0]" location] - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]"// - ["[1][0]" check] - ["[1]//" /// - [meta - ["[1][0]" code]]]]) - -(def .public random - (Random /.Definition) - (all random.and - (random.alphabetic 5) - (random.or $//check.random - $////code.random) - random.bit - )) - -(def compiler - [.#info [.#target "FAKE" - .#version "0.0.0" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#None} - .#modules (list) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (as (-> Type Code (Meta Any)) []) - .#host []]) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Definition]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random - - type $////code.random - untyped_value $////code.random] - (all _.and - (_.coverage [/.format /.parser] - (case (.result (/.parser compiler) - (list (/.format expected))) - {try.#Failure error} - false - - {try.#Success actual} - (at /.equivalence = expected actual))) - (_.coverage [/.typed] - (let [expected (has /.#value {.#Left [type untyped_value]} expected)] - (case (.result (/.typed compiler) - (list (/.format expected))) - {try.#Failure error} - false - - {try.#Success actual} - (at /.equivalence = expected actual)))) - (_.coverage [/.lacks_type] - (let [expected (has /.#value {.#Right untyped_value} expected)] - (case (.result (/.typed compiler) - (list (/.format expected))) - {try.#Failure error} - (exception.match? /.lacks_type error) - - {try.#Success actual} - false))) - ))) - )) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux deleted file mode 100644 index bace31485..000000000 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ /dev/null @@ -1,46 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["[0]" maybe] - ["[0]" try (.use "[1]#[0]" functor)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(def export - (Random [(Maybe Code) Nat]) - (all random.and - (|> random.bit - (at random.monad each code.bit) - random.maybe) - random.nat)) - -(def .public test - Test - (<| (_.covering /._) - (do random.monad - [[expected_export_policy expected_un_exported] ..export] - (_.coverage [/.parser /.default_policy] - (|> (case expected_export_policy - {.#Some expected_export_policy} - (list expected_export_policy (code.nat expected_un_exported)) - - {.#None} - (list (code.nat expected_un_exported))) - (.result (/.parser .nat)) - (try#each (function (_ [actual_export_policy actual_un_exported]) - (|> expected_export_policy - (maybe.else /.default_policy) - (code#= actual_export_policy) - (and (n.= expected_un_exported actual_un_exported))))) - (try.else false)))))) diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux deleted file mode 100644 index 2294518a9..000000000 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ /dev/null @@ -1,50 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["[0]" code - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]" //// - [meta - ["[1][0]" code]]]) - -(def .public random - (Random /.Input) - (all random.and - $////code.random - $////code.random - )) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Input]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser (list (/.format (list expected)))) - {try.#Failure _} - false - - {try.#Success actual} - (at (list.equivalence /.equivalence) = (list expected) actual))))))) diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux deleted file mode 100644 index d0c249716..000000000 --- a/stdlib/source/test/lux/macro/syntax/type/variable.lux +++ /dev/null @@ -1,39 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try (.use "[1]#[0]" functor)]] - [math - ["[0]" random (.only Random)]]]] - [\\library - ["[0]" / (.only) - [///// - [meta - ["[0]" code - ["<[1]>" \\parser]]]]]]) - -(def .public random - (Random /.Variable) - (random.alphabetic 10)) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Variable]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (|> (list (/.format expected)) - (.result /.parser) - (try#each (at /.equivalence = expected)) - (try.else false)))) - ))) diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux deleted file mode 100644 index 1269484f8..000000000 --- a/stdlib/source/test/lux/macro/template.lux +++ /dev/null @@ -1,117 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["[0]" try] - ["[0]" exception]] - [data - [collection - ["[0]" list]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] - [math - ["[0]" random (.only Random)] - [number - ["[0]" nat]]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(/.let [(!pow/2 ) - [(nat.* )]] - (def pow/2 - (-> Nat Nat) - (|>> !pow/2))) - -(def macro_error - (syntax (_ [macro .any]) - (function (_ compiler) - (case ((macro.expansion macro) compiler) - {try.#Failure error} - {try.#Success [compiler (list (code.text error))]} - - {try.#Success _} - {try.#Failure "OOPS!"})))) - -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - [left random.nat - mid random.nat - right random.nat] - (with_expansions [ (these [.5 -4 +3 2 #1 #0 c b "a"]) - ' ".5-4+32#1#0cba" - (these ["a" b c #0 #1 2 +3 -4 .5]) - ' "abc#0#12+3-4.5"] - (all _.and - (_.coverage [/.spliced] - (at (list.equivalence nat.equivalence) = - (list left mid right) - (`` (list (,, (/.spliced [left mid right])))))) - (_.coverage [/.amount] - (case (/.amount [left mid right]) - 3 true - _ false)) - (_.coverage [/.text] - (case (/.text ) - ' true - _ false)) - (_.coverage [/.symbol] - (and (case (`` (symbol (,, (/.symbol )))) - ["" '] true - _ false) - (case (`` (symbol (,, (/.symbol )))) - [' '] true - _ false) - )) - (_.coverage [/.with_locals] - (/.with_locals [var0 var1] - (let [var0 left - var1 right] - (and (nat.= left var0) - (nat.= right var1))))) - (do ! - [scalar random.nat] - (_.coverage [/.let] - (let [can_use_with_statements! - (nat.= (all nat.* scalar scalar) - (..pow/2 scalar))] - (and can_use_with_statements! - (/.let [(pow/3 ) - [(all nat.* )] - - (pow/9 ) - [(pow/3 (pow/3 ))]] - (let [can_use_with_expressions! - (nat.= (all nat.* scalar scalar scalar) - (pow/3 scalar)) - - can_refer! - (nat.= (all nat.* - scalar scalar scalar - scalar scalar scalar - scalar scalar scalar) - (pow/9 scalar)) - - can_shadow! - (let [pow/3 (function (_ scalar) - (all nat.+ scalar scalar scalar))] - (nat.= (all nat.+ scalar scalar scalar) - (pow/3 scalar)))] - (and can_use_with_expressions! - can_refer! - can_shadow!))) - )))) - (_.coverage [/.irregular_arguments] - (/.let [(arity/3 <0> <1> <2>) - [""]] - (exception.match? /.irregular_arguments - (macro_error (arity/3 "a" "b"))))) - ))) - )) diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index 382b84009..251e3e9ad 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -6,8 +6,6 @@ [monad (.only do)]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number @@ -16,7 +14,10 @@ ["r" rev] ["f" frac] ["[0]" ratio (.only Ratio)] - ["[0]" complex (.only Complex)]]]]] + ["[0]" complex (.only Complex)]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 98c4480d2..021bd0758 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -11,10 +11,10 @@ ["[0]" random (.only Random)] [number ["i" int]]] - [macro - [syntax (.only syntax)]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index adefb43e7..bf89cddbd 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -14,10 +14,11 @@ ["$[0]" codec]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math - ["[0]" random (.only Random)]]]] + ["[0]" random (.only Random)]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) [// (.except) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 2c2943c19..5cd2da267 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -20,15 +20,15 @@ [collection ["[0]" list (.use "[1]#[0]" functor monoid)] ["[0]" set]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number ["n" nat]]] [meta ["[0]" location] - ["[0]" symbol (.use "[1]#[0]" equivalence)]]]] + ["[0]" symbol (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["[0]" type (.use "[1]#[0]" equivalence)]]] @@ -38,7 +38,8 @@ ["[1][0]" symbol] ["[1][0]" configuration] ["[1][0]" version] - ["[1][0]" type]]) + ["[1][0]" type] + ["[1][0]" macro]]) (def !expect (template (_ ) @@ -1024,4 +1025,5 @@ /configuration.test /version.test /type.test + /macro.test ))) diff --git a/stdlib/source/test/lux/meta/code.lux b/stdlib/source/test/lux/meta/code.lux index 49db56a18..65d848f76 100644 --- a/stdlib/source/test/lux/meta/code.lux +++ b/stdlib/source/test/lux/meta/code.lux @@ -16,8 +16,6 @@ ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -27,7 +25,9 @@ ["[0]" frac]]] [meta ["[0]" symbol] - ["[0]" location]] + ["[0]" location] + [macro + ["^" pattern]]] [tool [compiler [language diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux index 141d7ed96..0630f5186 100644 --- a/stdlib/source/test/lux/meta/configuration.lux +++ b/stdlib/source/test/lux/meta/configuration.lux @@ -16,13 +16,13 @@ ["<[1]>" \\parser]] [collection ["[0]" list]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/macro.lux b/stdlib/source/test/lux/meta/macro.lux new file mode 100644 index 000000000..d128a74be --- /dev/null +++ b/stdlib/source/test/lux/meta/macro.lux @@ -0,0 +1,250 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + ["[0]" static] + [abstract + [monad (.only do)]] + [control + ["[0]" try (.use "[1]#[0]" functor)]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text (.only) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" functor)] + [number + ["n" nat]]] + ["[0]" meta (.only) + ["[0]" location] + ["[0]" symbol] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]] + [macro + ["^" pattern]]]]] + [\\library + ["[0]" / (.only) + [syntax (.only syntax)] + ["[0]" template]]] + ["[0]" / + ["[1][0]" local] + ["[1][0]" syntax] + ["[1][0]" template] + ["[1][0]" pattern] + ["[1][0]" context]]) + +(def !expect + (template (_ ) + [(case + true + _ false)])) + +(def !global + (template (_ ) + [(is [Text .Global] + [(template.text []) {.#Definition [true .Macro ]}])])) + +(def pow/2 + (syntax (_ [number .any]) + (in (list (` (n.* (, number) (, number))))))) + +(def pow/4 + (syntax (_ [number .any]) + (in (list (` (..pow/2 (..pow/2 (, number)))))))) + +(def repeated + (syntax (_ [times .nat + token .any]) + (in (list.repeated times token)))) + +(def fresh_symbol + (syntax (_ []) + (do meta.monad + [g!fresh (/.symbol "fresh")] + (in (list g!fresh))))) + +(def random_lux + (Random [Nat Text .Lux]) + (do [! random.monad] + [seed random.nat + symbol_prefix (random.upper_case 1) + .let [macro_module (symbol.module (symbol /._)) + current_module (symbol.module (symbol .._))]] + (in [seed + symbol_prefix + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (is (List [Text .Global]) + (list (!global /.log_single_expansion!) + (!global /.log_expansion!) + (!global /.log_full_expansion!))) + .#imports (list) + .#module_state {.#Active}]] + [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (is (List [Text .Global]) + (list (!global ..pow/2) + (!global ..pow/4) + (!global ..repeated))) + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed seed + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]]))) + +(def iterated + (syntax (_ [cycle .nat + it .any]) + (in (list (case cycle + 0 it + _ (` (..iterated (, (code.nat (-- cycle))) (, it)))))))) + +(def test|expansion + Test + (do [! random.monad] + [[seed symbol_prefix lux] ..random_lux + + pow/1 (at ! each code.nat random.nat) + + repetitions (at ! each (n.% 10) random.nat) + .let [single_expansion (` (..pow/2 (..pow/2 (, pow/1)))) + expansion (` (n.* (..pow/2 (, pow/1)) + (..pow/2 (, pow/1)))) + full_expansion (` (n.* (n.* (, pow/1) (, pow/1)) + (n.* (, pow/1) (, pow/1))))]] + (`` (all _.and + (,, (with_template [ ] + [(_.coverage [] + (|> ( (` (..pow/4 (, pow/1)))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = + (list ))) + (try.else false))) + + (_.coverage [] + (and (|> (/.single_expansion (` ( "omit" (..pow/4 (, pow/1))))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = (list))) + (try.else false)) + (|> (/.single_expansion (` ( (..pow/4 (, pow/1))))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = (list ))) + (try.else false))))] + + [/.single_expansion /.log_single_expansion! single_expansion] + [/.expansion /.log_expansion! expansion] + [/.full_expansion /.log_full_expansion! full_expansion] + )) + (_.coverage [/.one_expansion] + (bit#= (not (n.= 1 repetitions)) + (|> (/.one_expansion (` (..repeated (, (code.nat repetitions)) (, pow/1)))) + (meta.result lux) + (!expect {try.#Failure _})))) + (_.coverage [/.final] + (with_expansions [ (static.random_nat) + (static.random code.nat + (random#each (|>> (n.% 5) ++) random.nat)) + (/.final (..iterated ))] + (case (' ) + [_ {.#Nat actual}] + (n.= actual) + + _ + false))) + (_.coverage [/.times] + (with_expansions [ (static.random_nat) + (static.random code.nat + (random#each (|>> (n.% 10) (n.+ 2)) random.nat)) + (static.random code.nat + (random#each (|>> (n.% ) ++) random.nat)) + (/.times (..iterated ))] + (let [expected_remaining (n.- )] + (case (` ) + (^.` (..iterated (, [_ {.#Nat actual_remaining}]) (, [_ {.#Nat actual}]))) + (and (n.= expected_remaining actual_remaining) + (n.= actual)) + + _ + false)))) + )))) + +(def sum + (macro (_ tokens) + (loop (again [tokens tokens + output 0]) + (case tokens + {.#End} + (at meta.monad in (list (code.nat output))) + + {.#Item [_ {.#Nat head}] tail} + (again tail (n.+ head output)) + + _ + (meta.failure ""))))) + +(def sum' + (macro (_ tokens lux) + ((/.function ..sum) tokens lux))) + +(def .public test + Test + (<| (_.covering /._) + (all _.and + (do [! random.monad] + [[seed symbol_prefix lux] ..random_lux] + (all _.and + (_.coverage [/.symbol] + (|> (/.symbol symbol_prefix) + (at meta.monad each %.code) + (meta.result lux) + (!expect (^.multi {try.#Success actual_symbol} + (and (text.contains? symbol_prefix actual_symbol) + (text.contains? (%.nat seed) actual_symbol)))))) + (_.coverage [/.wrong_syntax_error] + (|> (/.single_expansion (` (/.log_single_expansion!))) + (meta.result lux) + (!expect (^.multi {try.#Failure error} + (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) + error))))) + (_.coverage [/.with_symbols] + (with_expansions [ (fresh_symbol)] + (|> (/.with_symbols [] + (at meta.monad in )) + (meta.result lux) + (!expect (^.multi {try.#Success [_ {.#Symbol ["" actual]}]} + (text.contains? (template.text []) + actual)))))) + (_.coverage [/.function] + (with_expansions [n/0 (static.random_nat) + n/1 (static.random_nat) + n/1 (static.random_nat)] + (n.= (..sum n/0 n/1 n/1) + (..sum' n/0 n/1 n/1)))) + )) + + ..test|expansion + + /local.test + /syntax.test + /template.test + /pattern.test + /context.test + ))) diff --git a/stdlib/source/test/lux/meta/macro/context.lux b/stdlib/source/test/lux/meta/macro/context.lux new file mode 100644 index 000000000..52df97710 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/context.lux @@ -0,0 +1,12 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)]]] + [\\library + ["[0]" /]]) + +(def .public test + Test + (<| (_.covering /._) + (_.property "TBD" false) + )) diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux new file mode 100644 index 000000000..1aa793639 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/local.lux @@ -0,0 +1,130 @@ +(.require + [library + [lux (.except with) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["<>" parser] + ["[0]" try] + ["[0]" exception]] + [data + [text + ["%" \\format]] + [collection + ["[0]" list + ["[0]" property]]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + ["[0]" meta (.only) + ["[0]" code (.only) + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] + [\\library + ["[0]" /]]) + +(/.let [!pow/2 (template (_ ) + [(n.* )])] + (def pow/2 + (-> Nat Nat) + (|>> !pow/2))) + +(def macro_error + (syntax (_ [macro .any]) + (function (_ compiler) + (case ((macro.expansion macro) compiler) + {try.#Failure error} + {try.#Success [compiler (list (code.text error))]} + + {try.#Success _} + {try.#Failure "OOPS!"})))) + +(def (constant output) + (-> Code Macro) + ("lux macro" + (function (_ inputs lux) + {try.#Success [lux (list output)]}))) + +(def with + (syntax (_ [name (.tuple (<>.and .text .text)) + constant .any + pre_remove .bit + body .any]) + (macro.with_symbols [g!output] + (do meta.monad + [pop! (/.push (list [name (..constant constant)])) + [module short] (meta.normal name) + _ (if pre_remove + (let [remove_macro! (is (-> .Module .Module) + (revised .#definitions (property.lacks short)))] + (function (_ lux) + {try.#Success [(revised .#modules (property.revised module remove_macro!) lux) + []]})) + (in []))] + (let [pre_expansion (` (let [(, g!output) (, body)] + (exec + (, pop!) + (, g!output))))] + (if pre_remove + (macro.full_expansion pre_expansion) + (in (list pre_expansion)))))))) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected random.nat] + (all _.and + (_.coverage [/.push] + (..with ["" "actual"] expected #0 + (n.= expected (..actual)))) + (_.coverage [/.unknown_module] + (exception.match? /.unknown_module + (..macro_error + (..with ["123yolo456" "actual"] expected #0 + (n.= expected (..actual)))))) + (_.coverage [/.cannot_shadow_definition] + (exception.match? /.cannot_shadow_definition + (..macro_error + (..with ["" "with"] expected #0 + (n.= expected (..actual)))))) + (_.coverage [/.unknown_definition] + (exception.match? /.unknown_definition + (<| ..macro_error + (..with ["" "actual"] expected #1) + (n.= expected (..actual))))) + (do ! + [scalar random.nat] + (_.coverage [/.let] + (let [can_use_with_statements! + (n.= (all n.* scalar scalar) + (..pow/2 scalar))] + (and can_use_with_statements! + (/.let [pow/3 (template (_ ) + [(all n.* )]) + pow/9 (template (_ ) + [(pow/3 (pow/3 ))])] + (let [can_use_with_expressions! + (n.= (all n.* scalar scalar scalar) + (pow/3 scalar)) + + can_refer! + (n.= (all n.* + scalar scalar scalar + scalar scalar scalar + scalar scalar scalar) + (pow/9 scalar)) + + can_shadow! + (let [pow/3 (function (_ scalar) + (all n.+ scalar scalar scalar))] + (n.= (all n.+ scalar scalar scalar) + (pow/3 scalar)))] + (and can_use_with_expressions! + can_refer! + can_shadow!))) + )))) + )))) diff --git a/stdlib/source/test/lux/meta/macro/pattern.lux b/stdlib/source/test/lux/meta/macro/pattern.lux new file mode 100644 index 000000000..7b9e161c1 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/pattern.lux @@ -0,0 +1,99 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat] + ["i" int] + ["f" frac]]] + [meta + ["[0]" code]]]] + [\\library + ["[0]" /]]) + +(type (Pair l r) + (Record + [#left l + #right r])) + +(def !pair + (template (_ ) + [[..#left + ..#right ]])) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_nat (at ! each (n.% 1) random.nat) + expected_int (at ! each (i.% +1) random.int) + expected_rev (random.either (in .5) + (in .25)) + expected_frac (random.either (in +0.5) + (in +1.25)) + expected_text (random.either (in "+0.5") + (in "+1.25"))] + (all _.and + (do [! random.monad] + [sample (at ! each (n.% 5) random.nat)] + (_.coverage [/.with_template] + (case sample + (/.with_template [] + [ true]) + ([0] [1] [2] [3] [4]) + + _ + false))) + (_.coverage [/.or] + (and (/.case expected_rev + (/.or .5 .25) true + _ false) + (/.case expected_frac + (/.or +0.5 +1.25) true + _ false) + (/.case expected_text + (/.or "+0.5" "+1.25") true + _ false))) + (_.coverage [/.let] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (/.case expected_pair + (/.let actual_pair (/.pattern (!pair actual_left actual_right))) + (and (/.same? expected_pair actual_pair) + (/.same? expected_nat actual_left) + (/.same? expected_int actual_right))))) + (_.coverage [/.multi] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (and (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + [actual_right + +0]) + true + + _ + false) + (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + (i.= +0 actual_right)) + true + + _ + false)))) + (_.coverage [/.|>] + (case expected_frac + (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) + (f.= (f.* +4.0 expected_frac) + actual_frac))) + (_.coverage [/.`] + (case (code.text expected_text) + (/.` "+0.5") true + (/.` "+1.25") true + _ false)) + )))) diff --git a/stdlib/source/test/lux/meta/macro/syntax.lux b/stdlib/source/test/lux/meta/macro/syntax.lux new file mode 100644 index 000000000..5c6b392f1 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax.lux @@ -0,0 +1,49 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [math + ["[0]" random] + [number + ["n" nat]]] + [meta + ["[0]" code + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["[0]" / + ["[1][0]" check] + ["[1][0]" declaration] + ["[1][0]" definition] + ["[1][0]" export] + ["[1][0]" input] + ["[1][0]" type + ["[1]/[0]" variable]]]) + +(def +/3 + (/.syntax (_ [a .any + b .any + c .any]) + (in (list (` (all n.+ (, a) (, b) (, c))))))) + +(def .public test + Test + (<| (_.covering /._) + (all _.and + (do random.monad + [x random.nat + y random.nat + z random.nat] + (_.coverage [/.syntax] + (n.= (all n.+ x y z) + (+/3 x y z)))) + + /check.test + /declaration.test + /definition.test + /export.test + /input.test + /type/variable.test + ))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/check.lux b/stdlib/source/test/lux/meta/macro/syntax/check.lux new file mode 100644 index 000000000..1820536b8 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/check.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["<>" parser] + ["[0]" try]] + [math + ["[0]" random (.only Random)]] + [meta + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]" //// + ["[1][0]" code]]) + +(def .public random + (Random /.Check) + (all random.and + $////code.random + $////code.random + )) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Check]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [[type value] ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser + (list (/.format [/.#type type + /.#value value]))) + {try.#Failure _} + false + + {try.#Success check} + (and (code#= type (the /.#type check)) + (code#= value (the /.#value check))))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux new file mode 100644 index 000000000..d81a44ac3 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]]]] + [\\library + ["[0]" / (.only) + [//// + ["[0]" code + ["<[1]>" \\parser]]]]]) + +(def .public random + (Random /.Declaration) + (let [word (random.alphabetic 10)] + (all random.and + word + (do [! random.monad] + [size (at ! each (n.% 10) random.nat)] + (random.list size word)) + ))) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Declaration]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser + (list (/.format expected))) + {try.#Failure _} + false + + {try.#Success actual} + (at /.equivalence = expected actual))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/definition.lux b/stdlib/source/test/lux/meta/macro/syntax/definition.lux new file mode 100644 index 000000000..878cc8ee9 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/definition.lux @@ -0,0 +1,96 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["<>" parser] + ["[0]" try] + ["[0]" exception]] + [math + ["[0]" random (.only Random)]] + [meta + ["[0]" location] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]"// + ["[1][0]" check] + ["[1]//" /// + ["[1][0]" code]]]) + +(def .public random + (Random /.Definition) + (all random.and + (random.alphabetic 5) + (random.or $//check.random + $////code.random) + random.bit + )) + +(def compiler + [.#info [.#target "FAKE" + .#version "0.0.0" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#None} + .#modules (list) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Definition]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random + + type $////code.random + untyped_value $////code.random] + (all _.and + (_.coverage [/.format /.parser] + (case (.result (/.parser compiler) + (list (/.format expected))) + {try.#Failure error} + false + + {try.#Success actual} + (at /.equivalence = expected actual))) + (_.coverage [/.typed] + (let [expected (has /.#value {.#Left [type untyped_value]} expected)] + (case (.result (/.typed compiler) + (list (/.format expected))) + {try.#Failure error} + false + + {try.#Success actual} + (at /.equivalence = expected actual)))) + (_.coverage [/.lacks_type] + (let [expected (has /.#value {.#Right untyped_value} expected)] + (case (.result (/.typed compiler) + (list (/.format expected))) + {try.#Failure error} + (exception.match? /.lacks_type error) + + {try.#Success actual} + false))) + ))) + )) diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux new file mode 100644 index 000000000..bace31485 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux @@ -0,0 +1,46 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["[0]" maybe] + ["[0]" try (.use "[1]#[0]" functor)]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]]) + +(def export + (Random [(Maybe Code) Nat]) + (all random.and + (|> random.bit + (at random.monad each code.bit) + random.maybe) + random.nat)) + +(def .public test + Test + (<| (_.covering /._) + (do random.monad + [[expected_export_policy expected_un_exported] ..export] + (_.coverage [/.parser /.default_policy] + (|> (case expected_export_policy + {.#Some expected_export_policy} + (list expected_export_policy (code.nat expected_un_exported)) + + {.#None} + (list (code.nat expected_un_exported))) + (.result (/.parser .nat)) + (try#each (function (_ [actual_export_policy actual_un_exported]) + (|> expected_export_policy + (maybe.else /.default_policy) + (code#= actual_export_policy) + (and (n.= expected_un_exported actual_un_exported))))) + (try.else false)))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/input.lux b/stdlib/source/test/lux/meta/macro/syntax/input.lux new file mode 100644 index 000000000..49ae69f1c --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/input.lux @@ -0,0 +1,49 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + ["[0]" code + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]" //// + ["[1][0]" code]]) + +(def .public random + (Random /.Input) + (all random.and + $////code.random + $////code.random + )) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Input]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser (list (/.format (list expected)))) + {try.#Failure _} + false + + {try.#Success actual} + (at (list.equivalence /.equivalence) = (list expected) actual))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux b/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux new file mode 100644 index 000000000..c0c2c146d --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux @@ -0,0 +1,38 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try (.use "[1]#[0]" functor)]] + [math + ["[0]" random (.only Random)]]]] + [\\library + ["[0]" / (.only) + [///// + ["[0]" code + ["<[1]>" \\parser]]]]]) + +(def .public random + (Random /.Variable) + (random.alphabetic 10)) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Variable]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (|> (list (/.format expected)) + (.result /.parser) + (try#each (at /.equivalence = expected)) + (try.else false)))) + ))) diff --git a/stdlib/source/test/lux/meta/macro/template.lux b/stdlib/source/test/lux/meta/macro/template.lux new file mode 100644 index 000000000..d2952d268 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/template.lux @@ -0,0 +1,117 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["[0]" try] + ["[0]" exception]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random)] + [number + ["[0]" nat]]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] + [\\library + ["[0]" /]]) + +(/.let [(!pow/2 ) + [(nat.* )]] + (def pow/2 + (-> Nat Nat) + (|>> !pow/2))) + +(def macro_error + (syntax (_ [macro .any]) + (function (_ compiler) + (case ((macro.expansion macro) compiler) + {try.#Failure error} + {try.#Success [compiler (list (code.text error))]} + + {try.#Success _} + {try.#Failure "OOPS!"})))) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [left random.nat + mid random.nat + right random.nat] + (with_expansions [ (these [.5 -4 +3 2 #1 #0 c b "a"]) + ' ".5-4+32#1#0cba" + (these ["a" b c #0 #1 2 +3 -4 .5]) + ' "abc#0#12+3-4.5"] + (all _.and + (_.coverage [/.spliced] + (at (list.equivalence nat.equivalence) = + (list left mid right) + (`` (list (,, (/.spliced [left mid right])))))) + (_.coverage [/.amount] + (case (/.amount [left mid right]) + 3 true + _ false)) + (_.coverage [/.text] + (case (/.text ) + ' true + _ false)) + (_.coverage [/.symbol] + (and (case (`` (symbol (,, (/.symbol )))) + ["" '] true + _ false) + (case (`` (symbol (,, (/.symbol )))) + [' '] true + _ false) + )) + (_.coverage [/.with_locals] + (/.with_locals [var0 var1] + (let [var0 left + var1 right] + (and (nat.= left var0) + (nat.= right var1))))) + (do ! + [scalar random.nat] + (_.coverage [/.let] + (let [can_use_with_statements! + (nat.= (all nat.* scalar scalar) + (..pow/2 scalar))] + (and can_use_with_statements! + (/.let [(pow/3 ) + [(all nat.* )] + + (pow/9 ) + [(pow/3 (pow/3 ))]] + (let [can_use_with_expressions! + (nat.= (all nat.* scalar scalar scalar) + (pow/3 scalar)) + + can_refer! + (nat.= (all nat.* + scalar scalar scalar + scalar scalar scalar + scalar scalar scalar) + (pow/9 scalar)) + + can_shadow! + (let [pow/3 (function (_ scalar) + (all nat.+ scalar scalar scalar))] + (nat.= (all nat.+ scalar scalar scalar) + (pow/3 scalar)))] + (and can_use_with_expressions! + can_refer! + can_shadow!))) + )))) + (_.coverage [/.irregular_arguments] + (/.let [(arity/3 <0> <1> <2>) + [""]] + (exception.match? /.irregular_arguments + (macro_error (arity/3 "a" "b"))))) + ))) + )) diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index f7825cfe8..8644c6057 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -11,12 +11,13 @@ ["$[0]" codec]]] [data ["[0]" text]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux index 86359c7de..d00adca34 100644 --- a/stdlib/source/test/lux/meta/type.lux +++ b/stdlib/source/test/lux/meta/type.lux @@ -19,15 +19,15 @@ [collection ["[0]" list] ["[0]" array]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] - ["[0]" code (.use "[1]#[0]" equivalence)]]]] + ["[0]" code (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" / (.use "[1]#[0]" equivalence)]] diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index d568d5b76..a8d6bfb34 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -21,12 +21,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor monoid)] ["[0]" set]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["/[1]" // (.use "[1]#[0]" equivalence)]]]) diff --git a/stdlib/source/test/lux/meta/type/primitive.lux b/stdlib/source/test/lux/meta/type/primitive.lux index 8766f07c2..899c0d75b 100644 --- a/stdlib/source/test/lux/meta/type/primitive.lux +++ b/stdlib/source/test/lux/meta/type/primitive.lux @@ -9,16 +9,16 @@ ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" math (.only) ["[0]" random] [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux index 00bb863c3..34a3bc422 100644 --- a/stdlib/source/test/lux/meta/type/resource.lux +++ b/stdlib/source/test/lux/meta/type/resource.lux @@ -15,13 +15,13 @@ ["[0]" identity (.only Identity)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only Res)]]) diff --git a/stdlib/source/test/lux/meta/type/unit/scale.lux b/stdlib/source/test/lux/meta/type/unit/scale.lux index 15b5dab9a..6a4a8c625 100644 --- a/stdlib/source/test/lux/meta/type/unit/scale.lux +++ b/stdlib/source/test/lux/meta/type/unit/scale.lux @@ -5,15 +5,15 @@ [abstract [monad (.only do)] [equivalence (.only Equivalence)]] - [macro - [syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number ["i" int] ["[0]" ratio (.use "[1]#[0]" equivalence)]]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux index e225265da..eebef8c0b 100644 --- a/stdlib/source/test/lux/meta/version.lux +++ b/stdlib/source/test/lux/meta/version.lux @@ -10,15 +10,15 @@ ["[0]" exception]] [data ["[0]" text]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random] [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index cedad66d5..1f31b3874 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -12,16 +12,16 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list]]] - [macro - [syntax (.only syntax)] - ["^" pattern]] [math ["[0]" random] [number ["n" nat (.use "[1]#[0]" decimal)]]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux index 739381cf4..0288ca3b1 100644 --- a/stdlib/source/test/lux/target/js.lux +++ b/stdlib/source/test/lux/target/js.lux @@ -17,15 +17,16 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat] ["i" int] ["f" frac] - ["[0]" i64]]]]] + ["[0]" i64]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux index 318f8ae57..129748613 100644 --- a/stdlib/source/test/lux/target/lua.lux +++ b/stdlib/source/test/lux/target/lua.lux @@ -20,15 +20,16 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat] ["i" int] ["f" frac] - ["[0]" i64]]]]] + ["[0]" i64]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux index 487daeb16..afa79d64e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux @@ -19,8 +19,6 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -30,6 +28,8 @@ ["r" rev]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] + [macro + ["[0]" template]] ["[0]" configuration ["$[1]" \\test]]] [tool diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux index 49dd92a3b..eb47e634e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux @@ -21,15 +21,16 @@ ["[0]" set] ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat (.use "[1]#[0]" interval)] ["i" int] ["r" rev] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["/[1]" // diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux index a1bae7897..24433b8d0 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -21,6 +20,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" symbol ["$[1]" \\test]] ["[0]" configuration diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux index 5a830ba38..19c701bef 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)] [\\specification @@ -23,6 +22,7 @@ ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.use "[1]#[0]" equivalence)] + ["[0]" macro] ["[0]" configuration ["$[1]" \\test]]]]] ["$" /////// diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux index fd16878b1..317a4ec53 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -19,6 +18,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" type (.use "[1]#[0]" equivalence) ["[0]" check]]]]] [\\library diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index b905363d0..5c1752fe3 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -16,6 +15,7 @@ ["[0]" random]] [meta ["[0]" code] + ["[0]" macro] ["[0]" type (.use "[1]#[0]" equivalence) ["[0]" check]]]]] [\\library diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux index f8f6e693c..2e7b3e031 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux @@ -17,8 +17,6 @@ [collection ["[0]" list (.use "[1]#[0]" monad monoid)] ["[0]" set]]] - ["[0]" macro (.only) - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -26,6 +24,8 @@ ["f" frac]]] [meta ["[0]" code] + ["[0]" macro (.only) + ["^" pattern]] ["[0]" symbol (.only) ["$[1]" \\test]] ["[0]" configuration diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 8c2212df4..efd22de9a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -21,6 +20,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" symbol ["$[1]" \\test]] ["[0]" type (.use "[1]#[0]" equivalence) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index e4631f5ad..10700d853 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -15,10 +15,11 @@ ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" dictionary (.only Dictionary)] ["[0]" set]]] - [macro - ["^" pattern]] [math - ["[0]" random (.only Random)]]] + ["[0]" random (.only Random)]] + [meta + [macro + ["^" pattern]]]] ["[0]" // ["[1][0]" primitive]] [\\ diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 85cb4dedc..309ba20ff 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -3,8 +3,6 @@ ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] - [math - ["[0]" random (.only Random)]] [control ["[0]" try]] [data @@ -16,8 +14,11 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]]] + [math + ["[0]" random (.only Random)]] + [meta + [macro + ["^" pattern]]]] [\\ ["[0]" / [//// diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux index 9f69c7972..46ae030bc 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux @@ -13,8 +13,6 @@ ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number @@ -22,7 +20,9 @@ ["[0]" i64] ["[0]" frac]]] [meta - ["[0]" symbol]] + ["[0]" symbol] + [macro + ["^" pattern]]] [tool [compiler [reference (.only) diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 5fd673e83..5133e9c39 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -17,10 +17,11 @@ [collection ["[0]" dictionary (.only Dictionary)] ["[0]" list]]] - [macro - ["^" pattern]] [math ["[0]" random]] + [meta + [macro + ["^" pattern]]] [time ["[0]" instant (.only Instant)]]]] ["[0]" / diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 25b652db6..ef44188ba 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -11,12 +11,13 @@ [collection ["[0]" list] ["[0]" set (.only Set)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index 7e890002b..370c1e6bd 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -6,11 +6,12 @@ [collection ["[0]" list] ["[0]" set (.only Set)]]] - [macro - ["[0]" template]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) -- cgit v1.2.3