Liutos / LiutCL

主动挖坑并打算努力填坑的一个简陋的Lisp解释器
33 stars 4 forks source link

想到个Scope处理方法 #3

Closed tusooa closed 8 years ago

tusooa commented 12 years ago
sub new
{
    my ($class, $parent) = @_;
    my $self = { parent => $parent, var => {}, };
    bless $self, $class;
}
sub find
{
    my ($self, $name) = @_;
    if (defined $self->{var}->{$name})
    {
        return $self->{var}->{$name};
    }
    elsif ($self->{parent})
    {
        return $self->{parent}->find ($name);
    }
    else
    {
        return $nil;
    }
}
tusooa commented 12 years ago

另。吾是想用perl写的。

Liutos commented 12 years ago

呃,我发现我已经看不太懂Perl的代码了,囧……

tusooa commented 8 years ago

四年前的自己写了什么?0 0 不过perl的lisp啊 cpan上有好多模块了x