5 has predicates => (is => 'ro', isa => HashRef[Predicate], required => 1);
7 has globals => (is => 'ro', isa => DictValue, required => 1);
9 has locals => (is => 'ro', isa => ArrayRef[DictValue], required => 1);
11 has lex_map => (is => 'ro', isa => HashRef[ArrayRef[Str]], required => 1);
13 #has known_facts => (is => 'ro', required => 1);
15 sub lookup_predicate {
16 my ($self, $predicate) = @_;
17 return $self->predicates->{$predicate} || die "No such predicate: $predicate";
21 my ($self, $symbol) = @_;
22 if ($symbol =~ /^[_A-Z]/) {
23 my @mapped = @{$self->lex_map->{$symbol}||[]}
24 or die "No such name in scope: $symbol";
26 $targ = $targ->get_member_at($_) for @mapped;
29 return $self->globals->get_member_at($symbol)
30 || die "No such name in scope: $symbol";
33 sub depth { $#{$_[0]->locals} }
37 $self->but(locals => [ @{$self->locals}[0..$to] ]);
42 if ($at =~ /^[0-9]+$/) {
43 return $self->locals->[$at];
45 return $self->globals->get_member_at($at);
49 my ($self, $at, $value) = @_;
50 if ($at =~ /^[0-9]+$/) {
51 my @locals = @{$self->locals};
52 $locals[$at] = $value;
58 globals => $self->globals->with_member_at($at, $value)
63 my ($self, @updates) = @_;
66 ($scope, @events) = ($_->apply_to($scope), @events) for @updates;
67 return ($scope, @events);