From: Marius Gavrilescu Date: Sat, 28 Apr 2018 15:15:19 +0000 (+0300) Subject: Compile T and NIL correctly X-Git-Tag: 0.005001~3 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=2aba73d532a55cd0cfa7a32b1e9270a15b0b53d7;p=app-scheme79asm.git Compile T and NIL correctly --- diff --git a/lib/App/Scheme79asm.pm b/lib/App/Scheme79asm.pm index 1590d85..602afd1 100644 --- a/lib/App/Scheme79asm.pm +++ b/lib/App/Scheme79asm.pm @@ -71,6 +71,7 @@ sub process { die "Type too large: $type\n" if $type >= (1 << $self->{type_bits}); die "Addr too large: $addr\n" if $addr >= (1 << $self->{addr_bits}); my $result = ($type << $self->{addr_bits}) + $addr; + unless ($location) { $self->{freeptr}++; $location = $self->{freeptr} diff --git a/lib/App/Scheme79asm/Compiler.pm b/lib/App/Scheme79asm/Compiler.pm index 7bb9121..d9a420f 100644 --- a/lib/App/Scheme79asm/Compiler.pm +++ b/lib/App/Scheme79asm/Compiler.pm @@ -106,7 +106,7 @@ sub new { my %self = ( symbols => ['', '', 'T'], nsymbols => 3, - symbol_map => {}, + symbol_map => {T => 2}, ); bless \%self, $class; } @@ -117,6 +117,9 @@ sub process_quoted { [LIST => 0] } elsif (scalarp $expr) { $expr = uc $expr; + if ($expr eq 'NIL') { + return [LIST => 0] + } if (!exists $self->{symbol_map}{$expr}) { $self->{symbol_map}{$expr} = $self->{nsymbols}; $self->{nsymbols}++;