38 lines
819 B
Scheme
Executable File
38 lines
819 B
Scheme
Executable File
#! /bin/sh
|
|
exec guile -L . -e main -s "$0" "$@"
|
|
!#
|
|
(use-modules (ice-9 getopt-long)
|
|
(scmvm vm))
|
|
|
|
(define *options-spec*
|
|
'((output (single-char #\o)
|
|
(value #t))
|
|
(help (single-char #\h)
|
|
(value #f))
|
|
(stack-size (value #t))
|
|
(memory-size (value #t))))
|
|
|
|
(define parse-options
|
|
(lambda (options)
|
|
(getopt-long options *options-spec*)))
|
|
|
|
(define (usage)
|
|
(format #t "Usage: scmvm.scm [-o outfile] mode infile
|
|
Compile or run Scheme programs
|
|
|
|
Commands:
|
|
\tcompile\t Compile the source into an object file
|
|
\trun\t Run the object file
|
|
|
|
Yes the VM runs on Scheme, no that doesn't make any sense\n")
|
|
(exit))
|
|
|
|
(define* (main #:optional args)
|
|
(define options (parse-options args))
|
|
(when (option-ref options 'help #f)
|
|
(usage)))
|
|
|
|
;; Local Variables:
|
|
;; mode: scheme
|
|
;; End:
|