A Rust implementation of the Starlark language
APACHE-2.0 License
There are several copies of this repo on GitHub, facebook/starlark-rust is the canonical one.
This project provides a Rust implementation of the Starlark language. Starlark (formerly codenamed Skylark) is a deterministic language inspired by Python3, used for configuration in the build systems Bazel, Buck and Buck2, of which Buck2 depends on this library. This project was originally developed in this repo, which contains a more extensive history.
There are at least three implementations of Starlark, one in Java, one in Go, and this one in Rust. We mostly follow the Starlark standard. If you are interested in trying out Rust Starlark, you can clone this repo and run:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ cargo run
$> 1+2
3
This project was started by Damien Martin-Guillerez. Version 0.4.0 of this library changed ownership from Google to Facebook.
Read this blog post for an overview of the library, the reasons behind Starlark, and how it might fit in to your project. There is also a 2 minute introductory video.
This project features:
Send
/Sync
, while non-frozenThis project also has three non-goals:
There are six components:
starlark_derive
, a proc-macro crate that defines the necessary macros forstarlark
the library, whichstarlark_map
, a library with memory-efficient ordered/unordered maps/setsstarlark_syntax
, a library with the AST of Starlark and parsing functions.starlark
the main library, with evaluator, standard library, debuggerstarlark_derive
, starlark_map
and most of starlark_syntax
.starlark_lsp
, a library providing anstarlark_bin
the binary, which provides interactive evaluation, IDE featuresstarlark
and starlark_lsp
libraries,In particular the starlark_bin
binary can be effectively used as a linter.
But for the REPL, evaluator and IDE features the starlark_bin
binary is only
aware of standard Starlark. Most Starlark embeddings supply extra functions and
data types to work with domain-specific concerns, and the lack of these bindings
will cause the REPL/evaluator to fail if they are used, and will give a subpar
IDE experience. In most cases you should write your own binary depending on the
starlark
library, integrating your domain-specific pieces, and then using the
bundled LSP functions to produce your own IDE/REPL/evaluator on top of those.
You should still be able to use the VS Code extension.
In this section we outline where we don't comply with the Starlark spec.
for
.CHANGELOG.md
with the changes since the last release.Cargo.toml
files. Bump them by 0.0.1starlark
to point at the latest starlark_derive
version.CHANGELOG.md
, LICENSE
and README.md
into eachcargo publish --allow-dirty --dry-run
, then without the --dry-run
, inv0.X.Y
, using the starlark
version as the name.Starlark Rust is Apache License, Version 2.0 licensed, as found in the LICENSE file.