From 96d80cf95a4fd503c73a487b433e8b48281185ee Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Mon, 28 Jun 2010 11:08:03 -0600 Subject: [PATCH] Using the datalog reader for racklog original commit: 12797fef41119f956e70537450a7f38339fa1d62 --- collects/datalog/eval.rkt | 1 + collects/datalog/lang/reader.rkt | 3 +-- collects/datalog/scribblings/datalog.scrbl | 2 +- collects/datalog/scribblings/racket.scrbl | 3 +++ collects/tests/racklog/lang/laps.txt | 2 ++ collects/tests/racklog/lang/long.txt | 1 + collects/tests/racklog/lang/says.txt | 1 + collects/tests/racklog/lang/true.txt | 1 + 8 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 collects/tests/racklog/lang/laps.txt create mode 100644 collects/tests/racklog/lang/long.txt create mode 100644 collects/tests/racklog/lang/says.txt create mode 100644 collects/tests/racklog/lang/true.txt diff --git a/collects/datalog/eval.rkt b/collects/datalog/eval.rkt index 82bf6b3..82f6e67 100644 --- a/collects/datalog/eval.rkt +++ b/collects/datalog/eval.rkt @@ -54,6 +54,7 @@ (provide/contract [current-theory (parameter/c mutable-theory/c)] + [print-literals ((listof literal?) . -> . void)] [eval-program (program/c . -> . void)] [eval-top-level-statement (statement/c . -> . void)] [eval-statement (statement/c . -> . (or/c void (listof literal?)))] diff --git a/collects/datalog/lang/reader.rkt b/collects/datalog/lang/reader.rkt index 4f9886b..dce4324 100644 --- a/collects/datalog/lang/reader.rkt +++ b/collects/datalog/lang/reader.rkt @@ -11,8 +11,7 @@ [(color-lexer) (dynamic-require 'datalog/tool/syntax-color 'get-syntax-token)] [(configure-runtime) - (λ () - (current-read-interaction even-read))] + (λ () (current-read-interaction even-read))] [else (default key defval)])) (require datalog/parse datalog/private/compiler) diff --git a/collects/datalog/scribblings/datalog.scrbl b/collects/datalog/scribblings/datalog.scrbl index 7f0a49f..790d12b 100644 --- a/collects/datalog/scribblings/datalog.scrbl +++ b/collects/datalog/scribblings/datalog.scrbl @@ -22,7 +22,7 @@ on tabling intermediate results ensures that all queries terminate. @table-of-contents[] -@section{Datalog Module Language} +@section[#:tag "datalog"]{Datalog Module Language} @defmodulelang[datalog] diff --git a/collects/datalog/scribblings/racket.scrbl b/collects/datalog/scribblings/racket.scrbl index 1c84a5c..3f0c234 100644 --- a/collects/datalog/scribblings/racket.scrbl +++ b/collects/datalog/scribblings/racket.scrbl @@ -538,6 +538,9 @@ This library provides facilities for evaluating Datalog. It can be required via: The @tech{theory} used by @racket[eval-program] and @racket[eval-stmt]. } +@defproc[(print-literals [ls (listof literal?)]) void]{ + Pretty formats the literals for display. } + @defproc[(eval-program [p program/c]) void]{ Evaluates @racket[p] using @racket[(current-theory)] as the @tech{theory}, printing query answers as it goes. diff --git a/collects/tests/racklog/lang/laps.txt b/collects/tests/racklog/lang/laps.txt new file mode 100644 index 0000000..d87ea5f --- /dev/null +++ b/collects/tests/racklog/lang/laps.txt @@ -0,0 +1,2 @@ +permit(rams, store, rams_couch). +permit(will, fetch, rams_couch). diff --git a/collects/tests/racklog/lang/long.txt b/collects/tests/racklog/lang/long.txt new file mode 100644 index 0000000..ebf5669 --- /dev/null +++ b/collects/tests/racklog/lang/long.txt @@ -0,0 +1 @@ +this_is_a_long_identifier_and_tests_the_scanners_concat_when_read_with_a_small_buffer. diff --git a/collects/tests/racklog/lang/says.txt b/collects/tests/racklog/lang/says.txt new file mode 100644 index 0000000..473484a --- /dev/null +++ b/collects/tests/racklog/lang/says.txt @@ -0,0 +1 @@ +says(tpme1, m1). diff --git a/collects/tests/racklog/lang/true.txt b/collects/tests/racklog/lang/true.txt new file mode 100644 index 0000000..48eb7ed --- /dev/null +++ b/collects/tests/racklog/lang/true.txt @@ -0,0 +1 @@ +true.