All Projects → google → Starlark Rust

google / Starlark Rust

Licence: apache-2.0
Starlark (https://github.com/bazelbuild/starlark) in Rust

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Starlark Rust

Rules nixpkgs
Rules for importing Nixpkgs packages into Bazel.
Stars: ✭ 88 (-53.68%)
Mutual labels:  bazel
Dbx build tools
Dropbox's Bazel rules and tools
Stars: ✭ 119 (-37.37%)
Mutual labels:  bazel
Rules swift
Bazel rules to build Swift on Apple and Linux platforms
Stars: ✭ 151 (-20.53%)
Mutual labels:  bazel
Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu
Ubuntu 18.04 How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line
Stars: ✭ 91 (-52.11%)
Mutual labels:  bazel
Xrtl
Cross-platform Real-Time Rendering Library
Stars: ✭ 108 (-43.16%)
Mutual labels:  bazel
Please
High-performance extensible build system for reproducible multi-language builds.
Stars: ✭ 1,856 (+876.84%)
Mutual labels:  bazel
Bazel Linting System
🌿💚 Experimental system for registering, configuring, and invoking source-code linters in Bazel.
Stars: ✭ 63 (-66.84%)
Mutual labels:  bazel
Rules jvm external
Bazel rules to resolve, fetch and export Maven artifacts
Stars: ✭ 167 (-12.11%)
Mutual labels:  bazel
Bazel Tools
Reusable bits for Bazel
Stars: ✭ 109 (-42.63%)
Mutual labels:  bazel
Continuous Integration
Bazel's Continuous Integration Setup
Stars: ✭ 151 (-20.53%)
Mutual labels:  bazel
Gke Bazel Demo
Building applications with bazel and deploying them on to GKE. This demo contains a java-spring-boot rest service and an angular front-end. Both containers are deployed on GKE.
Stars: ✭ 92 (-51.58%)
Mutual labels:  bazel
Entangled
enTangle'd is an amalgamation of all things Tangle
Stars: ✭ 107 (-43.68%)
Mutual labels:  bazel
Vscode Bazel
Bazel support for Visual Studio Code
Stars: ✭ 138 (-27.37%)
Mutual labels:  bazel
Distroless
🥑 Language focused docker images, minus the operating system.
Stars: ✭ 11,484 (+5944.21%)
Mutual labels:  bazel
Bazel Skylib
Common useful functions and rules for Bazel
Stars: ✭ 153 (-19.47%)
Mutual labels:  bazel
Cuda Design Patterns
Some CUDA design patterns and a bit of template magic for CUDA
Stars: ✭ 78 (-58.95%)
Mutual labels:  bazel
Rules closure
Closure rules for Bazel
Stars: ✭ 119 (-37.37%)
Mutual labels:  bazel
Buildbuddy
BuildBuddy is an open source Bazel build event viewer, result store, and remote cache.
Stars: ✭ 182 (-4.21%)
Mutual labels:  bazel
Rules kotlin
Bazel rules for Kotlin
Stars: ✭ 162 (-14.74%)
Mutual labels:  bazel
Rules apple line
LINE's Apple rules for Bazel
Stars: ✭ 151 (-20.53%)
Mutual labels:  bazel

Starlark in Rust

An implementation in Rust of the Starlark language

Build Status

Disclaimer: This is not an officially supported Google product. This project is supported on a best-effort basis and welcome contributions.

Starlark, formerly codenamed Skylark, is a non-Turing complete language based on Python that was made for the Bazel build system to define compilation plugin.

Starlark has at least 3 implementations: a Java one for Bazel, a Go one and this one.

This interpreter was made using the specification from the go version and the Python 3 documentation when things were unclear.

This interpreter does not support most of the go extensions (e.g. bitwise operator or floating point). It optionally includes a set type (by explicitly including starlark::linked_hash_set::global() environment), as an extension which is not specified in the official Starlark specification, but note that this is just an insertion-order-preserving set, and does not have optimisations for nesting as can be found in the starlark Java implementation's depset implementation. It uses signed 64-bit integers.

Usage

Crate

You can depend on the starlark crate, it is documented using docs.rs. Examples are listed under starlark/examples. You can run the examples using cargo run --example, such as

echo "str([x * 2 for x in range(10)])" | cargo run --example starlark-simple-cli

Command line REPL

A command line interpreter is also provided by this project under starlark-repl, it can interpret files passed at the command line and also start a REPL (Read-Eval-Print Loop). The usage of this program is:

Starlark in Rust interpreter

USAGE:
    starlark-rust [FLAGS] [OPTIONS] [file]...

FLAGS:
    -a, --ast           Parse and print AST instead of evaluating.
    -b, --build-file    Parse the build file format instead of full Starlark. See https://docs.rs/starlark/0.3.0-
                        pre/starlark/eval/index.html#build_file
    -h, --help          Prints help information
    -r, --repl          Run a REPL after files have been parsed.
    -V, --version       Prints version information

OPTIONS:
    -c <command>        Starlark command to run after files have been parsed.

ARGS:
    <file>...    Files to interpret

Development

Build

This project build with Cargo. Simply run cargo test to test it, cargo build --release to build a release version and cargo run to run the command-line interpreter.

Possible improvements and optimizations

  • Errors:
    • When an identifier is not found, we can suggest close identifier / keyword.
    • Fix suggestions maybe?
    • Better error spans.
    • Recoverable errors (don't stop at the first error, continue parsing).
  • Evaluation:
    • Static rewrite of the AST before evaluation (e.g. for constant values)
  • Awesome feature:
    • Implement a debugging protocol server side (compatible with the Java one, see (bazelbuild/vscode-bazel#6)).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].