prolog.scm 1.09 KB
Newer Older
1
(setlocale LC_ALL "")
2 3
(use-modules (system base language))
(use-modules (system repl repl))
4
(use-modules (system repl common))
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
(use-modules (ice-9 readline))
(activate-readline)

(load  (string-append (getenv "HOME") "/.guile"))

(define f0 (string-append (getenv "HOME") "/guile-prolog-scratch"))
(define f1 (string-append (getenv "HOME") "/guile-prolog-scratch/language"))
(define f2 (string-append (getenv "HOME")
			  "/guile-prolog-scratch/language/prolog"))
(define f3 (string-append (getenv "HOME")
			  "/guile-prolog-scratch/language/prolog/modules"))

(if (not (file-exists? f0))
    (mkdir f0))
(if (not (file-exists? f1))
    (mkdir f2))
(if (not (file-exists? f2))
    (mkdir f2))
(if (not (file-exists? f3))
    (mkdir f3))

(set! %load-path (cons f0 %load-path))

28 29 30 31
(define (f)
  (set-current-module
   ((language-make-default-environment (lookup-language 'prolog))))
  (let ((lang (lookup-language 'prolog)))
32 33 34 35 36 37 38 39 40
    (let lp ()
      (catch #t
	(lambda ()
	  (current-language lang)
	  (let ((status (start-repl lang)))
	    (if (pk (null? status))
		(run-hook exit-hook)
		(lp))))
	(lambda x (lp))))))
41
(f)