Compile T and NIL correctly
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 28 Apr 2018 15:15:19 +0000 (18:15 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 28 Apr 2018 15:15:19 +0000 (18:15 +0300)
lib/App/Scheme79asm.pm
lib/App/Scheme79asm/Compiler.pm

index 1590d8568db0552bdfe41444499da12916b28db4..602afd1484316615b334b804e6af01975f5982b6 100644 (file)
@@ -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}
index 7bb912189374cbe980a92841efab05177c7bfcbc..d9a420f1aaf03408e16c9dc9fa3ae6dc8e4c2a2e 100644 (file)
@@ -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}++;
This page took 0.011895 seconds and 4 git commands to generate.