about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-09-01 r/4567 refactor(tvix/eval): Upgrade to latest rnix-parserVincent Ambo1-7/+13
Since the latest published version of rnix-parser on crates.io, the crate has undergone major changes which are only available in the git repository at the moment. This commit updates the compiler to this newer version of rnix. Most notably, the entire AST provided by rnix is now wrapped in the AST type system. As a result of this traversal is much nicer in many places, especially for things like nested attribute selection. There are a handful of smaller features missing for full feature parity with the previous version, especially handling of path literals, but PRs for these already exist in rnix-parser. Change-Id: Icde6d393067976549492b7d89c4cc49e5e575fc7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6231 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-08-31 r/4558 chore(tvix/eval): return parse errors out of eval::interpretVincent Ambo1-2/+8
Change-Id: I14f25b9c85260c68be38abf07ed80121ead60c7b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6224 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi>
2022-08-30 r/4537 fix(tvix/eval): address various clippy lintsVincent Ambo1-1/+1
Change-Id: I3ea0f51475e80948adfeb5d1620c1f2665cc39bc Reviewed-on: https://cl.tvl.fyi/c/depot/+/6201 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-30 r/4534 feat(tvix/eval): implement chunk disassembler outputVincent Ambo1-1/+3
This makes for a much nicer view of an execution if `--feature disassembler` is set, for example: tvix-repl> let value = [ 1 2 { a = 1; } ]; in value ++ [ 1 ] === compiled bytecode (11 operations) === 02 OpConstant(1) 02 OpConstant(2) 02 OpConstant("a") 02 OpConstant(1) 02 OpAttrs(1) 02 OpList(3) 02 OpGetLocal(0) 02 OpConstant(1) 02 OpList(1) 02 OpConcat 02 OpCloseScope(1) === runtime trace === 0001 OpConstant(ConstantIdx(0)) [ 1 ] 0002 OpConstant(ConstantIdx(1)) [ 1 2 ] 0003 OpConstant(ConstantIdx(2)) [ 1 2 "a" ] 0004 OpConstant(ConstantIdx(3)) [ 1 2 "a" 1 ] 0005 OpAttrs(1) [ 1 2 { a = 1; } ] 0006 OpList(3) [ [ 1 2 { a = 1; } ] ] 0007 OpGetLocal(0) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] ] 0008 OpConstant(ConstantIdx(4)) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] 1 ] 0009 OpList(1) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] [ 1 ] ] 0010 OpConcat [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } 1 ] ] 0011 OpCloseScope(1) [ [ 1 2 { a = 1; } 1 ] ] => [ 1 2 { a = 1; } 1 ] :: list Change-Id: If79c7fd1f0f18255ddb3763c1ba585fda8041b1b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6195 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-28 r/4519 feat(tvix/eval): resolve relative path literalsVincent Ambo1-2/+4
Resolves relative paths (e.g. `./foo`) either relative to the location of the Nix file, or relative to the working directory if none is supplied. Change-Id: I70ec574657b221b458015117a004b6e4a9c25a30 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6185 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-26 r/4507 feat(tvix/eval): add mechanism for emitting warnings from compilerVincent Ambo1-3/+11
These can be used predominantly to emit warnings about things that the compiler can infer, such as deprecated language features. Change-Id: I3649c625459d7f3f95cdf42d5c651d23d66569ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/6174 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-24 r/4463 chore(tvix/eval): only print AST if requestedVincent Ambo1-1/+3
Change-Id: If32c7fd03458a27aecb8c473f2c48b12f8cb5175 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6128 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su>
2022-08-24 r/4461 feat(tvix/tests): check in Nix' language test suiteVincent Ambo1-5/+4
This adds scaffolding code for running the Nix language test suite. The majority of eval-okay-* tests should eventually be runnable as-is by Tvix, however the eval-fail-* tests might not as we intend to have more useful error messages than upstream Nix. Change-Id: I4f3227f0889c55e4274b804a3072850fb78dd1bd Reviewed-on: https://cl.tvl.fyi/c/depot/+/6126 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 r/4432 style(tvix/eval): display `Display` representation of runtime valuesVincent Ambo1-1/+1
Change-Id: Ifbe05c2da9493c9e132a2d2e94a451d6091542a5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6096 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 r/4424 fix(tvix/eval): print code even if runtime failsVincent Ambo1-6/+2
Change-Id: I357c9adf939cb6001afa73ad02282d94ee22d0ba Reviewed-on: https://cl.tvl.fyi/c/depot/+/6088 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-08-12 r/4417 refactor(tvix/eval): move NumberPair struct definition to vm moduleVincent Ambo1-1/+1
This isn't relevant to the value type itself. Change-Id: I678bc92a8a530b1081ed498bf3ff7925217bcc01 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6081 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
2022-08-12 r/4410 feat(tvix/eval): implement simple arithmetic binary operationsVincent Ambo1-1/+1
Implements simple arithmetic operations (+, -, *, /). There is some scaffolding included to pop and coerce pairs of numbers, as the Nix language will let arithmetic operators apply to arbitrary pairs of number types (always resulting in floats if the types are mixed). Change-Id: I5f62c363bdea8baa6ef812cc64c5406759d257cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6074 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-08-12 r/4408 chore(tvix/eval): wire things up for development flowVincent Ambo1-2/+21
This creates a REPL which outputs compiled bytecode, constants, and VM results for code snippets. Change-Id: If63f79a961456afd6a4cdf59b994107ff7ab8b47 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6072 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su>
2022-08-12 r/4401 chore(tvix/eval): bootstrap some evaluator boilerplateVincent Ambo1-0/+5
Change-Id: I7770a20948d18a8506c2418dea21202aa21a6ddc Reviewed-on: https://cl.tvl.fyi/c/depot/+/6064 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>