PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

starlark

starlark

starlark is a pl created in 2018 by Laurent Le Brun.

#368on PLDB 4Years Old 1.7kUsers
0Books 0Papers 3kRepos

The language used in Bazel. Starlark is designed to be small, simple, and thread-safe. Although it is inspired from Python, it is not a general-purpose language and most Python features are not included. Starlark is syntactically a subset of Python 3


Example from the web:
# Define a number number = 18 # Define a dictionary people = { "Alice": 22, "Bob": 40, "Charlie": 55, "Dave": 14, } names = ", ".join(people.keys()) # Alice, Bob, Charlie, Dave # Define a function def greet(name): """Return a greeting.""" return "Hello {}!".format(name) greeting = greet(names) above30 = [name for name, age in people.items() if age >= 30] print("{} people are above 30.".format(len(above30))) def fizz_buzz(n): """Print Fizz Buzz numbers from 1 to n.""" for i in range(1, n + 1): s = "" if i % 3 == 0: s += "Fizz" if i % 5 == 0: s += "Buzz" print(s if s else i) fizz_buzz(20)
Example from hello-world:
print("Hello World")

Language features

Feature Supported Example Token
Strings
"Hello world"
"
Print() Debugging print
Comments
# A comment
Line Comments
# A comment
#
Semantic Indentation ϴ
atmel-avr.html · starlark.html · transact-sql.html

View source

PLDB - Build the next great programming language · v2022 · Day 32 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com