1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-30 00:40:20 +02:00
guile/module/language/sassy/main.scm
Andy Wingo 66ff15e2f0 add the sassy x86 assembler
* module/Makefile.am: Add language/sassy.scm. Probably EXTRA_DIST the
  dependant files, too.
* module/language/sassy.scm: New file, the sassy loader. Sassy is
  originally R5RS code that loads a number of files. I've converted that
  toplevel file to be a Guile module that *includes* the subfiles, so
  that it all gets compiled together. It's a pretty bad hack though,
  because what I should be doing is including them relative to the
  sassy.scm source location, but we don't know that at expansion time.
  Something to fix.
  really bad hack in it so that it will compile correctly -- p

* module/language/sassy/: All the sassy files and some changelog
  information. All of these files are LGPLv2.1+, so they can be included
  in Guile.

* test-suite/standalone/sassy/tests/: Add the sassy unit tests.
* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-sassy: Hook the sassy unit tests up to our
  test suite.
2009-08-13 18:48:20 +02:00

58 lines
2 KiB
Scheme

; main.scm - Sassy's main
; Copyright (C) 2005 Jonathan Kraut
; This library is free software; you can redistribute it and/or
; modify it under the terms of the GNU Lesser General Public
; License as published by the Free Software Foundation; either
; version 2.1 of the License, or (at your option) any later version.
; This library is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; Lesser General Public License for more details.
; You should have received a copy of the GNU Lesser General Public
; License along with this library; if not, write to the Free Software
; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
; Contact:
; Jonathan Kraut
; 4130 43 ST #C2
; Sunnyside, NY 11104
; jak76@columbia.edu
; see file COPYING in the top of Sassy's distribution directory
; module parse
; import macros api parse
; export sassy
;=======================;
; ;
; Sassy Main ;
; ;
;=======================;
(define (sassy input)
(let ((output (make-sassy-output
(list (make-hash-table)) ; empty symbol table
'() ; empty reloc list
#f ; no entry point
(make-pushdown-stack) ; empty data stack
(make-pushdown-stack) ; empty text stack
4 ; default heap align
4 ; default data align
16 ; default text align
0 ; initial heap size
0 ; default text org
32))) ; default bits size
(sassy-expand (make-hash-table)) ; install fresh macro table
(cond ((string? input) (parse-directives (read-file input) output))
((pair? input) (parse-directives input output))
(else (error "sassy: bad input" input)))
(sassy-symbol-table-set! output (car (sassy-symbol-table output)))
output))