MoonJsonnet
Copyright 2026 pangbit

Independent implementation based on the Jsonnet language specification,
language reference and standard-library contracts at https://jsonnet.org/.

Development-only reference: Google Jsonnet v0.21.0
https://github.com/google/jsonnet
Copyright Google Inc.; Apache License 2.0.
Pinned commit: bbb38f1020be1f5aed560928fb839b2c448cefb4.
No upstream interpreter is bundled or linked.
Except for the attributed upstream lint and formatter inputs below, the committed differential
inputs and example fixtures are original project material, distributed under this
project's Apache-2.0 license. The reference
checkout retains its own LICENSE and third-party notices outside this package.
tools/upstream-language.mbtx executes selected upstream Apache-2.0 test files
and extracts individual formatting assertions into temporary test artifacts.
These upstream assertions remain Google copyright and are not bundled in the
published package. See the pinned reference checkout for their license headers.

Functional implementation reference: Google go-jsonnet v0.21.0
https://github.com/google/go-jsonnet
Copyright Google Inc.; Apache License 2.0.
Pinned commit: 67968688d9952f50662e979fab1bef889d0d3e57.
The Go interpreter executable is used only for development-time behavioral
comparisons; no Go interpreter or Go runtime is bundled or linked into this package.

cmd/jsonnetfmt/args.mbt and its file-mode control flow adapt cmd/jsonnetfmt/cmd.go
at the same pinned revision. syntax_diagnostic.mbt follows its raw-parser range
rendering and internal/parser/string_util.go's exact malformed-Unicode byte context.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).

tests/go-lint.json includes the pinned go-jsonnet linter/testdata/*.jsonnet inputs.
Copyright Google Inc.; Apache License 2.0 (see LICENSE). These development-only
fixtures are excluded from the published package. lint.mbt and lint_children.mbt
adapt lexical-use and eager local-cycle analysis from linter/internal/variables,
linter/internal/traversal and internal/parser/context.go at that same revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).

tests/go-ast.json includes formatter/testdata/empty_comment.jsonnet and
formatter/testdata/regular_expression.jsonnet from that pinned go-jsonnet revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE). These inputs exercise raw
parsing and source retention, not formatter output, and are excluded from the package.

lint_type_*.mbt adapt conservative type-graph inference, checks and declarations
from linter/internal/types at the same pinned go-jsonnet revision.
lint_lower.mbt adapts analysis-only lowering from internal/program/desugarer.go.
token.mbt, lexer_number.mbt and the lexer/parser diagnostic and operator-token paths adapt
internal/parser/lexer.go and parser.go at the same revision.
string_literal.mbt adapts internal/parser/string_util.go at that revision;
normal quoted strings are validated and decoded when consumed by the parser.
Numeric literal spelling and deferred overflow follow ast/ast.go and the
LiteralNumber evaluation path in interpreter.go at the same pinned revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).
tools/embed-lint-stdlib.mbtx verifies the reference revision and source hash.

internal/quote/quote.mbt, lexer_number.mbt rune quoting and internal/quote/print.mbt
adapt Go 1.24.0 src/strconv/quote.go and
src/strconv/isprint.go. Copyright 2009 The Go Authors. All rights reserved.
BSD 3-Clause terms: licenses/GO-BSD-3-Clause.txt.
tools/embed-lint-print.mbtx verifies the exact source SHA-256 before extraction.

json_diagnostic.mbt adapts Go 1.24.0 src/encoding/json/scanner.go's iterative
syntax/error transition rules. Copyright 2010 The Go Authors. All rights reserved.
BSD 3-Clause terms: licenses/GO-BSD-3-Clause.txt. JSON values continue to be
parsed by MoonBit core; the diagnostic scan only runs after parsing fails.

manifest_toml.mbt, manifest_yaml.mbt and manifest_text.mbt adapt the native
TOML/YAML rendering contracts and control flow in the pinned go-jsonnet
builtins.go and interpreter.go to MoonBit, including quoting and key recognition.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).

stdlib_source.mbt embeds the Jsonnet standard-library source from the pinned
go-jsonnet astgen/stdast.go above. Copyright Google Inc.; Apache License 2.0
(see LICENSE and the original header embedded in stdlib_source.mbt).
tools/embed-stdlib.mbtx verifies the reference revision and extracts the source;
stdlib_layer.mbt selects supported definitions. This Jsonnet source is evaluated
by MoonJsonnet's own MoonBit interpreter; no Go interpreter is required at runtime.

format_power.mbt adapts the fractional base-10 evaluation path from the Go
standard library, Go 1.24.0 src/math/pow.go:
https://github.com/golang/go/blob/go1.24.0/src/math/pow.go
Copyright 2009 The Go Authors. All rights reserved.
It is distributed under the BSD 3-Clause terms in licenses/GO-BSD-3-Clause.txt.
This is separate from the development-only go-jsonnet interpreter reference.

reference_math.mbt, reference_trig.mbt, reference_log.mbt and internal/number/math.c
adapt Go 1.24.0 src/math/atan.go, atan2.go, asin.go, exp.go, exp_arm64.s,
exp_amd64.s, log_amd64.s, pow.go, sin.go, tan.go, and trig_reduce.go:
https://github.com/golang/go/tree/go1.24.0/src/math
Copyright 2009, 2011, 2017, 2018 The Go Authors. All rights reserved.
BSD 3-Clause terms: licenses/GO-BSD-3-Clause.txt. Inherited Cephes and Sun
Microsystems notices are retained in licenses/GO-MATH-NOTICES.txt.

unicode_fold.mbt and tests/unicode-fold-pairs.json are generated from
Go 1.24.0 src/unicode/tables.go (Unicode 15.0.0):
https://github.com/golang/go/blob/go1.24.0/src/unicode/tables.go
Copyright 2009 The Go Authors. All rights reserved.
BSD 3-Clause terms: licenses/GO-BSD-3-Clause.txt.
tools/embed-unicode.mbtx verifies the exact source SHA-256 before extraction.

MoonBit core is provided by the user's toolchain, not vendored here.

source_range.mbt and parser.mbt source-span, local-binding and parameter range rules follow
go-jsonnet v0.21.0 ast/location.go, ast/ast.go, internal/parser/parser.go and
internal/program/desugarer.go at commit
67968688d9952f50662e979fab1bef889d0d3e57:
https://github.com/google/go-jsonnet/tree/v0.21.0
Copyright Google Inc.; Apache License 2.0 (see LICENSE).

raw_ast.mbt and parser.mbt's raw-node instrumentation extend the MoonBit parser
with an independently assembled lossless concrete syntax tree. The development-only
tests/reference/formatter-node.go adapter compares edited nodes with the pinned
Go FormatNode API; tests/go-formatter-node.json uses original project inputs.
The raw-tree and formatting APIs execute entirely in MoonBit and do not link Go.

Repeated parameter binding and default selection in eval.mbt follow go-jsonnet
value.go checkArguments and thunks.go closure.evalCall at that same revision.

eval_hook.mbt, debug_scope.mbt and debugger.mbt adapt evaluation observation,
captured-variable analysis and stepping contracts from interpreter.go,
internal/program/static_analyzer.go and debugger.go at the pinned revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).
tests/reference/debugger.go exercises the public reference API only during
development; the hook, inspection and debugger runtime executes in MoonBit.

diagnostic_trace.mbt, diagnostic_formatter.mbt and the execution trace paths
adapt named contexts, clean-frame snapshots, synthetic manifestation locations,
cropping and source/color rendering from interpreter.go, error_formatter.go,
runtime_error.go, internal/parser/context.go, internal/program/desugarer.go and
ast/location.go at that same pinned go-jsonnet revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE).
The development-only tests/reference/diagnostic.go adapter uses public VM and
ErrorFormatter APIs; product execution and rendering remain entirely MoonBit.

formatter*.mbt (except formatter_sort*.mbt) implement formatting rules from internal/formatter,
internal/parser/lexer.go and internal/parser/string_util.go at the same pinned go-jsonnet revision.
Copyright Google Inc.; Apache License 2.0 (see LICENSE). This native
formatter does not bundle or invoke Go at runtime.

formatter_sort.mbt, formatter_sort_partition.mbt and formatter_sort_pivot.mbt
adapt the exact unstable sort.Slice path from Go 1.24.0 src/sort/slice.go,
zsortfunc.go and sort.go. Copyright 2009, 2017, 2022 The Go Authors. All rights reserved.
BSD 3-Clause terms: licenses/GO-BSD-3-Clause.txt. This preserves observable
equal-key import ordering and does not invoke a Go runtime.

internal/yaml contains the syntax/event parser from moonbit-community/yaml.mbt,
commit e2f1129249a7cc707aa1c9c39bd8bfe207c93821 (0.0.7 source):
https://github.com/moonbit-community/yaml.mbt
Copyright 2025 International Digital Economy Academy. MIT terms are retained in
licenses/YAML-MIT.txt. Parser::next_token is exposed for bounded event consumption;
the plain-scalar colon rule follows go-yaml v2. The dependency's JSON schema
resolver and emitter are not used.

The parser/scanner diagnostic distinction, line rendering, anchor names and
directive checks in parse_yaml.mbt and internal/yaml/parser.mbt follow the pinned
reference's sigs.k8s.io/yaml v1.4.0 goyaml.v2 decode.go/parserc.go contracts.
Go YAML code is Apache-2.0 (see LICENSE); parserc.go retains libyaml's MIT terms,
Copyright (c) 2006 Kirill Simonov, copied to licenses/GOYAML-LIBYAML-MIT.txt.
These changed paths execute solely in the MoonBit parser and interpreter.

Automation scripts use moonbitlang/async (Apache-2.0), resolved by Moon script mode; it is not
a library runtime dependency. Official examples informed the package layout:
https://github.com/moonbitlang/async/tree/main/examples
