Sign In
Browse Source

Implement basic - and *

Although multiplication doesn't work, because the `mul` instruction
seems to be a bit special.
Lucas Stadler 9 years ago
parent
commit
a361ef0cbb
2 changed files with 18 additions and 1 deletions
  1. 10 0
      scm/inc/compiler.scm
  2. 8 1
      scm/inc/tests.scm

+ 10 - 0
scm/inc/compiler.scm

@ -159,6 +159,16 @@
159 159
     (emit "movl %eax, ~a(%rsp)" si) ; move second arg on the stack
160 160
     (emit-expr (primcall-operand1 x) (- si wordsize) env)
161 161
     (emit "addl ~a(%rsp), %eax" si))
162
    ((-)
163
     (emit-expr (primcall-operand2 x) si env)
164
     (emit "movl %eax, ~a(%rsp)" si) ; move second arg on the stack
165
     (emit-expr (primcall-operand1 x) (- si wordsize) env)
166
     (emit "subl ~a(%rsp), %eax" si))
167
    ((*)
168
     (emit-expr (primcall-operand2 x) si env)
169
     (emit "movl %eax, ~a(%rsp)" si) ; move second arg on the stack
170
     (emit-expr (primcall-operand1 x) (- si wordsize) env)
171
     (emit "mull ~a(%rsp), %eax" si))
162 172
    ((cons)
163 173
     (emit-expr (primcall-operand1 x) si env)
164 174
     (emit "movl %eax, 0(%rsi)") ; set the car

+ 8 - 1
scm/inc/tests.scm

@ -106,7 +106,14 @@
106 106
    ["(+ 0 0)" "0\n"]
107 107
    ["(+ 41 1)" "42\n"]
108 108
    ["(+ 1 41)" "42\n"]
109
    ["(+ -10 11)" "1\n"]])
109
    ["(+ -10 11)" "1\n"]
110
111
    ["(- 1 2)" "-1\n"]
112
    ["(- 42 0)" "42\n"]
113
    ["(- 0 42)" "-42\n"]
114
115
    ;["(* 3 4)" "12\n"]
116
    ])
110 117
111 118
(do-tests "3.5 - local variables"
112 119
  '[["(let ((x 3) (y 4)) (+ x y))" "7\n"]

Page Not Found - git.papill0n.org

404


Application Version: 0.9.13.0318

If you think this is an error, please open an issue on GitHub.

~/.crontab: Add cronjob for homegrown news thing. · d1917ade83 - git.papill0n.org
Browse Source

~/.crontab: Add cronjob for homegrown news thing.

It's very unfinished, but it does *something*.
Lucas Stadler 13 years ago
parent
commit
d1917ade83
1 changed files with 1 additions and 0 deletions
  1. 1 0
      .crontab

+ 1 - 0
.crontab

@ -1,5 +1,6 @@
1 1
10 * * * * offlineimap -u ttyui > /home/lu/.offlineimap.log
2 2
*  * * * * /home/lu/.bin/warn-if-low.sh
3 3
*  * * * * date --rfc-3339=seconds >> /home/lu/.pings
4
0  * * * * PYTHONPATH=/home/lu/k/news/libs/ python /home/lu/k/news/news.py 'http://rockpapershotgun.com' 'http://prog21.dadgum.com' 'http://codinghorror.com' > /home/lu/k/news/feed.html
4 5
5 6
* 0-7,19-23 * * * DISPLAY=:0 zenity --error --text "get off the computer!"

confidence - git.papill0n.org

No Description

.aliases 496B

    alias ls='ls --group-directories-first --color=auto' alias grep='grep --color=auto' alias dstat='dstat --black-on-white' # shortcuts alias tomorrow="vim ~/d/tomorrow -c ':Goyo'" alias v="vim -c ':Goyo'" alias b="firefox" #alias wn="sdcv --use-dict=WordNet" #alias wb="sdcv --use-dict=\"Webster's Revised Unabridged Dictionary (1913)\"" alias docker-ip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" # projects alias clarity="cd ~/k/lp/clj/clarity" alias pixl="cd ~/k/lp/js/pixl"
Accedi - git.papill0n.org

Accedi