• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmd/skylark/H01-Nov-2018-8868

doc/H01-Nov-2018-4,2543,256

docs/H03-May-2022-11

internal/H01-Nov-2018-2,2151,640

repl/H01-Nov-2018-228135

resolve/H01-Nov-2018-1,153798

skylarkstruct/H01-Nov-2018-617457

skylarktest/H01-Nov-2018-189135

syntax/H03-May-2022-5,1774,201

testdata/H01-Nov-2018-2,4282,091

.travis.ymlH A D01-Nov-201899 106

CNAMEH A D01-Nov-201816 21

LICENSEH A D01-Nov-20181.5 KiB3024

README.mdH A D01-Nov-20185.7 KiB166125

empty.sH A D01-Nov-2018179 40

eval.goH A D01-Nov-201831.5 KiB1,276992

eval_test.goH A D01-Nov-201814.3 KiB496417

example_test.goH A D01-Nov-20187.6 KiB292189

hashtable.goH A D01-Nov-20188.1 KiB359287

hashtable_test.goH A D01-Nov-20182.1 KiB9876

int.goH A D01-Nov-20185.9 KiB222169

interp.goH A D01-Nov-201811.9 KiB563467

library.goH A D01-Nov-201858.7 KiB2,1691,806

value.goH A D01-Nov-201834.5 KiB1,201805

value_test.goH A D01-Nov-20181.1 KiB4734

README.md

1
2<!-- This file is the project homepage at github.com/google/skylark -->
3
4# Skylark in Go
5
6**Skylark is now called Starlark.  The project has moved to [go.starlark.net](https://go.starlark.net).**
7
8
9This is the home of the _Skylark in Go_ project.
10Skylark in Go is an interpreter for Skylark, implemented in Go.
11
12Skylark is a dialect of Python intended for use as a configuration language.
13Like Python, it is an untyped dynamic language with high-level data
14types, first-class functions with lexical scope, and garbage collection.
15Unlike CPython, independent Skylark threads execute in parallel, so
16Skylark workloads scale well on parallel machines.
17Skylark is a small and simple language with a familiar and highly
18readable syntax. You can use it as an expressive notation for
19structured data, defining functions to eliminate repetition, or you
20can use it to add scripting capabilities to an existing application.
21
22A Skylark interpreter is typically embedded within a larger
23application, and the application may define additional domain-specific
24functions and data types beyond those provided by the core language.
25For example, Skylark was originally developed for the
26[Bazel build tool](https://bazel.build).
27Bazel uses Skylark as the notation both for its BUILD files (like
28Makefiles, these declare the executables, libraries, and tests in a
29directory) and for [its macro
30language](https://docs.bazel.build/versions/master/skylark/language.html),
31through which Bazel is extended with custom logic to support new
32languages and compilers.
33
34
35## Documentation
36
37* Language definition: [doc/spec.md](doc/spec.md)
38
39* About the Go implementation: [doc/impl.md](doc/impl.md)
40
41* API documentation: [godoc.org/github.com/google/skylark](https://godoc.org/github.com/google/skylark)
42
43* Mailing list: [skylark-go](https://groups.google.com/forum/#!forum/skylark-go)
44
45* Issue tracker: [https://github.com/google/skylark/issues](https://github.com/google/skylark/issues)
46
47* Travis CI: ![Travis CI](https://travis-ci.org/google/skylark.svg) [https://travis-ci.org/google/skylark](https://travis-ci.org/google/skylark)
48
49### Getting started
50
51Build the code:
52
53```shell
54$ go get github.com/google/skylark/...
55$ go build github.com/google/skylark/cmd/skylark
56```
57
58Run the interpreter:
59
60```
61$ cat coins.sky
62coins = {
63  'dime': 10,
64  'nickel': 5,
65  'penny': 1,
66  'quarter': 25,
67}
68print('By name:\t' + ', '.join(sorted(coins.keys())))
69print('By value:\t' + ', '.join(sorted(coins.keys(), key=coins.get)))
70
71$ ./skylark coins.sky
72By name:	dime, nickel, penny, quarter
73By value:	penny, nickel, dime, quarter
74```
75
76Interact with the read-eval-print loop (REPL):
77
78```
79$ ./skylark
80>>> def fibonacci(n):
81...    res = list(range(n))
82...    for i in res[2:]:
83...        res[i] = res[i-2] + res[i-1]
84...    return res
85...
86>>> fibonacci(10)
87[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
88>>>
89```
90
91When you have finished, type `Ctrl-D` to close the REPL's input stream.
92
93### Contributing
94
95We welcome submissions but please let us know what you're working on
96if you want to change or add to the Skylark repository.
97
98Before undertaking to write something new for the Skylark project,
99please file an issue or claim an existing issue.
100All significant changes to the language or to the interpreter's Go
101API must be discussed before they can be accepted.
102This gives all participants a chance to validate the design and to
103avoid duplication of effort.
104
105Despite some differences, the Go implementation of Skylark strives to
106match the behavior of the Java implementation used by Bazel.
107For that reason, proposals to change the language itself should
108generally be directed to the Bazel team, not to the maintainers of
109this project.
110Only once there is consensus that a language change is desirable may
111its Go implementation proceed.
112
113We use GitHub pull requests for contributions.
114
115Please complete Google's contributor license agreement (CLA) before
116sending your first change to the project.  If you are the copyright
117holder, you will need to agree to the
118[individual contributor license agreement](https://cla.developers.google.com/about/google-individual),
119which can be completed online.
120If your organization is the copyright holder, the organization will
121need to agree to the [corporate contributor license agreement](https://cla.developers.google.com/about/google-corporate).
122If the copyright holder for your contribution has already completed
123the agreement in connection with another Google open source project,
124it does not need to be completed again.
125
126### Stability
127
128We reserve the right to make breaking language and API changes at this
129stage in the project, although we will endeavor to keep them to a minimum.
130Now that the project's long-term name ("Starlark") has been decided,
131we plan to copy this repository to github.com/google/starlark and
132change the canonical import path for all packages to starlark.net/starlark.
133The current github.com/google/skylark repository will be frozen.
134Once the Bazel team has finalized the version 1 language specification,
135we will be more rigorous with interface stability.
136
137### Credits
138
139Skylark was designed and implemented in Java by
140Ulf Adams,
141Lukács Berki,
142Jon Brandvein,
143John Field,
144Laurent Le Brun,
145Dmitry Lomov,
146Damien Martin-Guillerez,
147Vladimir Moskva, and
148Florian Weikert,
149standing on the shoulders of the Python community.
150The Go implementation was written by Alan Donovan and Jay Conrod;
151its scanner was derived from one written by Russ Cox.
152
153### Legal
154
155Skylark in Go is Copyright (c) 2017 The Bazel Authors.
156All rights reserved.
157
158It is provided under a 3-clause BSD license:
159[LICENSE](https://github.com/google/skylark/blob/master/LICENSE).
160
161The name "Skylark" is a code name of the Bazel project.
162The Bazel team plans to rename the language to "Starlark" to reflect its
163applicability to projects unrelated to Bazel.
164
165Skylark in Go is not an official Google product.
166