Thanks to visit codestin.com
Credit goes to lib.rs

#configuration-language #starlark #config-language

bin+lib strangemeadowlark

Parser for the Starlark configuration language. Ported from https://github.com/google/starlark-go

15 releases

Uses new Rust 2024

0.6.1 Feb 10, 2026
0.5.0 Apr 28, 2025
0.4.3 Jan 18, 2025
0.3.0 Sep 24, 2024
0.1.0 Nov 1, 2023

#310 in Development tools

Apache-2.0

355KB
9K SLoC

This package implements parsing and name resolution for the Starlark language. Starlark is a dialect of Python intended for use as a configuration language. Its main use is for extending the Bazel build system.

This partial implementation is a port of starlark-go to Rust.

The main use of this package is for extracting information from BUILD files. There is a basic interpreter, but it is more than unlikely to evolve into a full implementation.

If you want a complete implementation, you may want to reach for starlark-go or try starlark-rust instead.

Development

Testing

To run the standard test suite:

cargo test

Buildifier Parity Tests

This project includes integration tests that verify the pretty-printed output against buildifier, the standard formatter for Starlark. These tests ensure that strangemeadowlark produces output that is consistent with the canonical style.

To run these tests specifically:

cargo test --test buildifier_parity_test

Note: These tests require the buildifier binary to be installed and available in your system's PATH. If buildifier is not found, the tests will be skipped automatically (marked as passed with a message).

Test with Leak Sanitizer

This library uses bumpalo and an AST that is using references. This has the advantage of enabling pattern matching on ASTs. However as the docs say, bumpalo will not call Drop, and this makes it very easy to leak memory.

When making changes, run the following to detect leaks:

RUSTFLAGS="-Z sanitizer=leak -Zexport-executable-symbols" cargo test --target x86_64-unknown-linux-gnu

The -Zexport-executable-symbols is a workaround.

The stacktraces will not be useful, unless they are symbolized. For that, you want llvm-symbolizer in your path.

Dependencies

~3.5MB
~57K SLoC