Fixing PR12085

This commit is contained in:
Jay McCarthy 2011-08-08 11:55:49 -06:00
parent f0e52b80df
commit a4f70ae598
4 changed files with 48 additions and 14 deletions

View File

@ -0,0 +1,20 @@
#lang racket/base
(define (configure data)
;; (printf "Configuring\n")
(current-read-interaction even-read))
(provide configure)
(require datalog/parse
racklog/lang/compiler)
; XXX This is almost certainly wrong.
(define (even-read src ip)
(begin0
(compile-statement
(parameterize ([current-source-name src])
(parse-statement ip)))
(current-read-interaction odd-read)))
(define (odd-read src ip)
(current-read-interaction even-read)
eof)

View File

@ -0,0 +1,10 @@
#lang racket/base
(define (get-info data)
(λ (key default)
(case key
[(configure-runtime)
'(#(racklog/lang/configure-runtime configure #f))]
[else
default])))
(provide get-info)

View File

@ -4,6 +4,8 @@
#:read (lambda ([in (current-input-port)]) (this-read-syntax #f in))
#:read-syntax this-read-syntax
#:whole-body-readers? #t
#:language-info
'#(racklog/lang/lang-info get-info #f)
#:info (lambda (key defval default)
; XXX Should have different comment character key
(case key
@ -11,8 +13,6 @@
(dynamic-require 'datalog/tool/submit 'repl-submit?)]
[(color-lexer)
(dynamic-require 'datalog/tool/syntax-color 'get-syntax-token)]
[(configure-runtime)
(λ () (current-read-interaction even-read))]
[else (default key defval)]))
(require datalog/parse
racklog/lang/compiler)
@ -21,15 +21,4 @@
(list
(compile-program
(parameterize ([current-source-name src])
(parse-program in)))))
; XXX This is almost certainly wrong.
(define (even-read src ip)
(begin0
(compile-statement
(parameterize ([current-source-name src])
(parse-statement ip)))
(current-read-interaction odd-read)))
(define (odd-read src ip)
(current-read-interaction even-read)
eof))
(parse-program in))))))

View File

@ -0,0 +1,15 @@
#lang racklog
% Run parent_child(P,C)?
mother_child(trude, sally).
father_child(tom, sally).
father_child(tom, erica).
father_child(mike, tom).
sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).
parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).