summaryrefslogtreecommitdiff
path: root/modules/language/python/#spec.scm#
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-11-06 23:31:41 +0100
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-11-06 23:31:41 +0100
commit13c923ed2fb507dc0a9e21726edb095d6855df8b (patch)
tree13d273e5ad03f6daa9017ab7010f4093ca943a21 /modules/language/python/#spec.scm#
parent520e15905eb2d220a7acc0ca96ea08a1e1cc8555 (diff)
cleanup
Diffstat (limited to 'modules/language/python/#spec.scm#')
-rw-r--r--modules/language/python/#spec.scm#68
1 files changed, 0 insertions, 68 deletions
diff --git a/modules/language/python/#spec.scm# b/modules/language/python/#spec.scm#
deleted file mode 100644
index 8291a14..0000000
--- a/modules/language/python/#spec.scm#
+++ /dev/null
@@ -1,68 +0,0 @@
-(define-module (language python spec)
- #:use-module (language python guilemod)
- #:use-module (parser stis-parser lang python3-parser)
- #:use-module ((language python module python) #:select ())
- #:use-module (language python compile)
- #:use-module (language python completer)
- #:use-module (rnrs io ports)
- #:use-module (ice-9 pretty-print)
- #:use-module (ice-9 readline)
- #:use-module (system base compile)
- #:use-module (system base language)
- #:use-module (language scheme compile-tree-il)
- #:use-module (language scheme decompile-tree-il)
- #:use-module (ice-9 rdelim)
- #:export (python))
-
-;;;
-;;; Language definition
-;;;
-
-(define (pr . x)
- (define port (open-file "/home/stis/src/python-on-guile/log.txt" "a"))
- (with-output-to-port port
- (lambda ()
- (pretty-print x) (car (reverse x))))
- (close port)
- (car (reverse x)))
-
-(define (c x) (pr (comp (pr (p (pr x))))))
-(define (cc port x)
- (if (equal? x "") (read port) (c x)))
-
-(define (e x) (eval (c x) (current-module)))
-
-(catch #t
- (lambda ()
- (set! (@@ (ice-9 readline) *readline-completion-function*)
- (complete-fkn e)))
- (lambda x #f))
-
-(define-language python
- #:title "python"
- #:reader (lambda (port env)
- (if (not (fluid-ref (@@ (system base compile) %in-compile)))
- (cc port (read-line port))
- (cc port (read-string port))))
-
- #:compilers `((tree-il . ,compile-tree-il))
- #:decompilers `((tree-il . ,decompile-tree-il))
- #:evaluator (lambda (x module) (primitive-eval x))
- #:printer write
- #:make-default-environment
- (lambda ()
- ;; Ideally we'd duplicate the whole module hierarchy so that `set!',
- ;; `fluid-set!', etc. don't have any effect in the current environment.
- (let ((m (make-fresh-user-module)))
- ;; Provide a separate `current-reader' fluid so that
- ;; compile-time changes to `current-reader' are
- ;; limited to the current compilation unit.
- (module-define! m 'current-reader (make-fluid))
-
- ;; Default to `simple-format', as is the case until
- ;; (ice-9 format) is loaded. This allows
- ;; compile-time warnings to be emitted when using
- ;; unsupported options.
- (module-set! m 'format simple-format)
-
- m)))