Go to file
Liang Mingqiang ce84685fb0 Sort FreeVariables slice (#148)
* sort FreeVariables slice

* regenerate the standard library AST
2017-11-09 08:55:36 -05:00
ast Sort FreeVariables slice (#148) 2017-11-09 08:55:36 -05:00
cmd experiment dump ast to source code (#101) 2017-11-07 23:31:11 -05:00
compat Support of +:, in, in super 2017-09-28 22:21:46 -04:00
compat_test Some placeholders and experiments for C library 2017-09-27 22:01:29 -04:00
dump Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
jsonnet Feature-complete commandline interface (#138) 2017-11-03 22:00:30 -04:00
parser String token end location off-by-one error (#139) 2017-11-03 21:36:31 -04:00
std update stdlib (#143) 2017-11-03 00:46:13 -04:00
testdata String token end location off-by-one error (#139) 2017-11-03 21:36:31 -04:00
_gen.go Finish up blocking out the parser. 2016-03-01 17:08:35 -08:00
.gitignore Optional eval (#92) 2017-10-10 00:06:14 -04:00
.travis.yml travis: update go version 2017-09-19 23:48:34 -04:00
builtins.go experiment dump ast to source code (#101) 2017-11-07 23:31:11 -05:00
CONTRIBUTING Add CONTRIBUTING, add newline to end of other files 2016-02-19 17:36:19 -05:00
desugarer_test.go First end-to-end test (addition of numbers) 2016-03-08 01:17:44 -05:00
desugarer.go Support for native callbacks 2017-10-13 15:49:06 -04:00
doc.go Remove go:generate causing errors 2017-09-29 12:36:04 -04:00
error_formatter.go max_trace==0 means no trace limit (#141) 2017-11-03 00:33:31 -04:00
evaluator.go Allow bitwise operations on floats, according to Spec (and Javascript behavior) 2017-10-26 20:26:16 -04:00
imports.go search jpaths from right to left, compatibility with cpp (#140) 2017-11-03 00:33:43 -04:00
interpreter_test.go First end-to-end test (addition of numbers) 2016-03-08 01:17:44 -05:00
interpreter.go experiment dump ast to source code (#101) 2017-11-07 23:31:11 -05:00
LICENSE Add CONTRIBUTING, add newline to end of other files 2016-02-19 17:36:19 -05:00
main_test.go Feature-complete commandline interface (#138) 2017-11-03 22:00:30 -04:00
mutually_recursive_defaults.input Optional eval (#92) 2017-10-10 00:06:14 -04:00
README.md Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
reset_stdast_go.sh Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
runtime_error.go Location, error formatting and stack trace improvements (#59) 2017-10-03 14:27:44 -04:00
static_analyzer_test.go Move AST to its own package 2017-08-25 00:30:56 -04:00
static_analyzer.go Sort FreeVariables slice (#148) 2017-11-09 08:55:36 -05:00
std.go Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
std.thisFile.jsonnet Optional eval (#92) 2017-10-10 00:06:14 -04:00
tests.sh tell tests which implementation we are using (#142) 2017-11-03 00:41:40 -04:00
thunks.go Make NativeFunction members public (#135) 2017-10-24 23:00:40 -04:00
value.go Basic tailstrict support 2017-10-13 15:33:23 -04:00
vm.go experiment dump ast to source code (#101) 2017-11-07 23:31:11 -05:00

go-jsonnet

GoDoc Widget Travis Widget Coverage Status Widget

This an implementation of Jsonnet in pure Go. It is feature complete but is not as heavily exercised as the Jsonnet C++ implementation. Please try it out and give feedback.

This code is known to work on Go 1.6 and above.

Build instructions

export GOPATH=$HOME/go-workspace
mkdir -pv $GOPATH
go get github.com/google/go-jsonnet
cd $GOPATH/src/github.com/google/go-jsonnet
cd jsonnet
go build
./jsonnet /dev/stdin <<< '{x: 1, y: self.x} + {x: 10}'
{
   "x": 10,
   "y": 10
}

Implementation Notes

We are generating some helper classes on types by using http://clipperhouse.github.io/gen/. Do the following to regenerate these if necessary:

go get github.com/mjibson/esc
go get github.com/clipperhouse/gen
go get github.com/clipperhouse/set
export PATH=$PATH:$GOPATH/bin  # If you haven't already
go generate

Generated Stdlib

To regenerate the standard library, do:

./reset_stdast_go.sh && go run cmd/dumpstdlibast.go