You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/aabbtree77/determinism

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/aabbtree77/determinism

v0.0.0-20241121123624-9602c110a2d3
Source
Go
Version published
Created
Source

A Tree-Walking Interpreter

This is a fork of the March 30 2018 commit #96 of Starlark-Go:

git checkout -b tree-walker 0d5491befad9f6af126fdcb886dc58a8f059bea7

It is the latest commit which contains a tree-walking interpreter of Starlark. Afterwards Alan Donovan et al. moved on to a bytecode compiler-interpreter.

git clone https://github.com/aabbtree77/determinism.git
cd determinism
go build ./cmd/starlark
./starlark coins.star
By name:	dime, nickel, penny, quarter
By value:	penny, nickel, dime, quarter
go test -v
cd syntax
go test -v

The idea here is to make the tree walker more visible for learning and exploration.

Minor code restoration: Added go.mod, fixed the paths for the tests not passing due to $GOPATH in a few places, took care of #32479, replaced "skylark" with "starlark" in code, but not in the docs as they contain links.

Remarks

  • The books by Thorsten Ball are great, but Starlark-Go is the next level, yet under 10 KLOC of Go.

  • example_test.go states a demo of the concurrent cache with cycle detection for Starlark module loading in Go. More of that in Sect. 9.7 of the book by Alan A. A. Donovan and Brian W. Kernighan gopl.io.

  • hashtable.go does a hash map from scratch in less than 350 lines of Go.

  • For some real uses of Starlark-Go it could be worth checking out Clace.

FAQs

Package last updated on 21 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.