feat(tvix/eval): compile with expression
Adds an additional structure to the compiler's scope to track the runtime "with stack", i.e. the stack of values through which identifiers should be dynamically resolved within a with-scope. When encountering a `with` expression, the value from which the bindings should be resolved is pushed onto the stack and tracked by the compiler in the "with stack", as well as with a "phantom value" which indicates that the stack contains an additional slot which is not available to users via identifiers. Runtime handling of this is not yet implemented. Change-Id: I5e96fb55b6378e8e2a59c20c8518caa6df83da1c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6217 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
ec7db0235f
commit
7cfdedfdfb
3 changed files with 65 additions and 11 deletions
|
|
@ -276,6 +276,8 @@ impl VM {
|
|||
let value = self.stack[local_idx].clone();
|
||||
self.push(value)
|
||||
}
|
||||
|
||||
OpCode::OpPushWith(_idx) => todo!("with handling not implemented"),
|
||||
}
|
||||
|
||||
#[cfg(feature = "disassembler")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue