mescc.scm: print two strings.

This commit is contained in:
Jan Nieuwenhuizen 2016-08-14 09:06:09 +02:00
parent 2c7f26dbe6
commit 04eb0609cd
2 changed files with 7 additions and 5 deletions

3
main.c
View file

@ -1,5 +1,6 @@
int main ()
{
puts ("Hello, [messi] world!");
puts ("Hi Mes!\n");
puts ("Hello, world!\n");
return 1;
}

View file

@ -472,11 +472,12 @@
(string->list (cadr (caddr o))))
'()))
(define (statement->text o)
(define (statement->text data o)
(cond
((and (pair? o) (eq? (car o) 'call))
(let ((string (cadr (caddr o))))
(list (lambda (data) (i386:puts data (string-length string))))))
(let ((string (cadr (caddr o)))
(offset (length data)))
(list (lambda (data) (i386:puts (+ data offset) (string-length string))))))
((and (pair? o) (eq? (car o) 'return))
(list (lambda (data) (i386:exit (cadr o)))))
(else '())))
@ -500,5 +501,5 @@
(display statement (current-error-port))
(newline (current-error-port))
(loop (cdr statements)
(append text (statement->text statement))
(append text (statement->text data statement))
(append data (statement->data statement)))))))