diff --git a/collects/datalog/ast.rkt b/collects/datalog/ast.rkt index 9e51487cd6..ed41f663ea 100644 --- a/collects/datalog/ast.rkt +++ b/collects/datalog/ast.rkt @@ -1,4 +1,4 @@ -#lang scheme +#lang racket (define srcloc/c (or/c syntax? diff --git a/collects/datalog/eval.rkt b/collects/datalog/eval.rkt index 2e10fdc8ad..b52537f269 100644 --- a/collects/datalog/eval.rkt +++ b/collects/datalog/eval.rkt @@ -1,9 +1,9 @@ -#lang scheme -(require scheme/list +#lang racket +(require racket/list (except-in (planet dherman/pprint:4) empty) - "ast.ss" - "pretty.ss" - "runtime.ss") + "ast.rkt" + "pretty.rkt" + "runtime.rkt") (define current-theory (make-parameter (make-mutable-theory))) diff --git a/collects/datalog/info.rkt b/collects/datalog/info.rkt index e9f35bdec6..82bc5ce3a0 100644 --- a/collects/datalog/info.rkt +++ b/collects/datalog/info.rkt @@ -4,7 +4,7 @@ (list "An implementation of Datalog as a Racket language.")) (define scribblings '(["scribblings/datalog.scrbl" (multi-page)])) (define categories '(devtools)) -(define primary-file "main.ss") +(define primary-file "main.rkt") (define compile-omit-paths '("tests")) (define release-notes (list)) (define repositories '("4.x")) diff --git a/collects/datalog/lang/lang.rkt b/collects/datalog/lang/lang.rkt index dbeefaf41c..475b7d8065 100644 --- a/collects/datalog/lang/lang.rkt +++ b/collects/datalog/lang/lang.rkt @@ -1,7 +1,7 @@ -#lang scheme/base -(require (for-syntax scheme/base - "../private/compiler.ss") - "../pretty.ss" +#lang racket/base +(require (for-syntax racket/base + "../private/compiler.rkt") + "../pretty.rkt" (only-in (planet dherman/pprint:4) pretty-print)) diff --git a/collects/datalog/lang/module.rkt b/collects/datalog/lang/module.rkt index 05a0b02eb9..deaae87af0 100644 --- a/collects/datalog/lang/module.rkt +++ b/collects/datalog/lang/module.rkt @@ -1,7 +1,7 @@ -#lang scheme/base -(require "lang.ss") +#lang racket/base +(require "lang.rkt") (provide (rename-out [module-begin #%module-begin]) - (except-out (all-from-out scheme/base) + (except-out (all-from-out racket/base) #%top-interaction #%module-begin)) \ No newline at end of file diff --git a/collects/datalog/lang/reader.rkt b/collects/datalog/lang/reader.rkt index 4155f056a8..ea940552c9 100644 --- a/collects/datalog/lang/reader.rkt +++ b/collects/datalog/lang/reader.rkt @@ -1,5 +1,5 @@ (module reader syntax/module-reader - #:language `(planet ,(this-package-version-symbol lang/module)) + #:language 'datalog/lang/module #:read (lambda ([in (current-input-port)]) (let ([ast (parse-program in)]) (list `(#%module-begin ,@ast)))) @@ -12,7 +12,6 @@ ; XXX repl submit (case key [(color-lexer) - (dynamic-require `(planet ,(this-package-version-symbol drscheme/syntax-color)) 'get-syntax-token)] + (dynamic-require `datalog/tool/syntax-color) 'get-syntax-token)] [else (default key defval)])) - (require (planet cce/scheme:6/planet) - "../parse.ss")) \ No newline at end of file + (require "../parse.rkt")) \ No newline at end of file diff --git a/collects/datalog/main.rkt b/collects/datalog/main.rkt index 0bf1fc0d1b..3d4186d1c6 100644 --- a/collects/datalog/main.rkt +++ b/collects/datalog/main.rkt @@ -1,13 +1,13 @@ -#lang scheme -(require "ast.ss" - "parse.ss" - "sexp.ss" - "pretty.ss" - "runtime.ss" - "eval.ss") -(provide (all-from-out "ast.ss" - "parse.ss" - "sexp.ss" - "pretty.ss" - "runtime.ss" - "eval.ss")) \ No newline at end of file +#lang racket +(require "ast.rkt" + "parse.rkt" + "sexp.rkt" + "pretty.rkt" + "runtime.rkt" + "eval.rkt") +(provide (all-from-out "ast.rkt" + "parse.rkt" + "sexp.rkt" + "pretty.rkt" + "runtime.rkt" + "eval.rkt")) \ No newline at end of file diff --git a/collects/datalog/parse.rkt b/collects/datalog/parse.rkt index caa20d0c7e..5c3f116c21 100644 --- a/collects/datalog/parse.rkt +++ b/collects/datalog/parse.rkt @@ -1,8 +1,8 @@ -#lang scheme +#lang racket (require parser-tools/lex parser-tools/yacc - "private/lex.ss" - "ast.ss") + "private/lex.rkt" + "ast.rkt") #| 5.1 Literals diff --git a/collects/datalog/pretty.rkt b/collects/datalog/pretty.rkt index 167d972089..cf1944f55a 100644 --- a/collects/datalog/pretty.rkt +++ b/collects/datalog/pretty.rkt @@ -1,6 +1,6 @@ -#lang scheme +#lang racket (require (planet dherman/pprint:4) - "ast.ss") + "ast.rkt") (define (format-datum s) (cond diff --git a/collects/datalog/private/compiler.rkt b/collects/datalog/private/compiler.rkt index 79e920943d..86fee23749 100644 --- a/collects/datalog/private/compiler.rkt +++ b/collects/datalog/private/compiler.rkt @@ -1,9 +1,9 @@ -#lang scheme/base -(require scheme/contract - "../ast.ss" - (for-syntax scheme/base)) -(require (for-template scheme/base - "../eval.ss")) +#lang racket/base +(require racket/contract + "../ast.rkt" + (for-syntax racket/base)) +(require (for-template racket/base + "../eval.rkt")) (define (compile-module asts) (with-syntax ([(s ...) asts]) diff --git a/collects/datalog/private/env.rkt b/collects/datalog/private/env.rkt index 625c93dee0..8e12bedfa1 100644 --- a/collects/datalog/private/env.rkt +++ b/collects/datalog/private/env.rkt @@ -1,5 +1,5 @@ -#lang scheme -(require "../ast.ss") +#lang racket +(require "../ast.rkt") (define env/c (and/c hash? immutable?)) diff --git a/collects/datalog/private/lex.rkt b/collects/datalog/private/lex.rkt index 59d61fa986..459752d53a 100644 --- a/collects/datalog/private/lex.rkt +++ b/collects/datalog/private/lex.rkt @@ -1,4 +1,4 @@ -#lang scheme +#lang racket (require parser-tools/lex (prefix-in : parser-tools/lex-sre)) diff --git a/collects/datalog/private/subst.rkt b/collects/datalog/private/subst.rkt index b5fade6e9c..3ec35811fc 100644 --- a/collects/datalog/private/subst.rkt +++ b/collects/datalog/private/subst.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require "../ast.ss" - "env.ss") +#lang racket +(require "../ast.rkt" + "env.rkt") (define (subst-term env t) (match t diff --git a/collects/datalog/private/unify.rkt b/collects/datalog/private/unify.rkt index 354f9be6fc..8943e27ec6 100644 --- a/collects/datalog/private/unify.rkt +++ b/collects/datalog/private/unify.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require "../ast.ss" - "env.ss") +#lang racket +(require "../ast.rkt" + "env.rkt") (define (chase env t) (match t diff --git a/collects/datalog/private/variant.rkt b/collects/datalog/private/variant.rkt index 44996544f4..e28981d46e 100644 --- a/collects/datalog/private/variant.rkt +++ b/collects/datalog/private/variant.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require "../ast.ss" - "env.ss") +#lang racket +(require "../ast.rkt" + "env.rkt") ; Variants (define (variant-terms env1 env2 ts1 ts2) diff --git a/collects/datalog/runtime.rkt b/collects/datalog/runtime.rkt index 0cca202dd0..e6837b1cba 100644 --- a/collects/datalog/runtime.rkt +++ b/collects/datalog/runtime.rkt @@ -1,9 +1,9 @@ -#lang scheme -(require "ast.ss" - "private/env.ss" - "private/subst.ss" - "private/unify.ss" - "private/variant.ss") +#lang racket +(require "ast.rkt" + "private/env.rkt" + "private/subst.rkt" + "private/unify.rkt" + "private/variant.rkt") ; A clause is safe if every variable in its head occurs in some literal in its body. (define (safe-clause? c) diff --git a/collects/datalog/scribblings/datalog.scrbl b/collects/datalog/scribblings/datalog.scrbl index 0d106894e7..ccb4885cae 100644 --- a/collects/datalog/scribblings/datalog.scrbl +++ b/collects/datalog/scribblings/datalog.scrbl @@ -3,16 +3,14 @@ scribble/eval scribble/basic scribble/bnf - (planet cce/scheme:6/planet) - (planet cce/scheme:6/scribble) (for-label (planet dherman/pprint:4) - scheme/base - scheme/contract - "../main.ss") - "utils.ss") + racket/base + racket/contract + "../main.rkt") + "utils.rkt") @title[#:tag "top"]{@bold{Datalog} for PLT Scheme} -@author[(author+email "Jay McCarthy" "jay@plt-scheme.org")] +@author[(author+email "Jay McCarthy" "jay@racket-lang.org")] This package contains a lightweight deductive database system. Queries and database updates are expressed using @link["http://en.wikipedia.org/wiki/Datalog"]{Datalog}---a declarative logic language in which each @@ -70,7 +68,7 @@ the REPL. Datalog is also available as a module language. This can be used by beginning a Datalog source file with the line: -@(scheme #,(hash-lang) planet #,(this-package-version-symbol)) +@(racket #,(hash-lang) planet #,(this-package-version-symbol)) You can omit the PLaneT version numbers if you prefer. Programs without the version number do not need to be updated when this PLaneT package is upgraded. However, it is then the @@ -83,61 +81,61 @@ Start DrScheme and choose the @tt{Datalog} language from DrScheme's @tt{Language} menu under @tt{Experimental Languages}. Click @onscreen{Run}, then click in the REPL. -@schemeinput[] +@racketinput[] @tech{Facts} are stored in tables. If the name of the table is @litchar["parent"], and @litchar["john"] is the parent of @litchar["douglas"], store the fact in the database with this: -@schemeinput[#,(tt "parent(john, douglas).")] +@racketinput[#,(tt "parent(john, douglas).")] Each item in the parenthesized list following the name of the table is called a @tech{term}. -A term can be either a logical @scheme[variable] or a @scheme[constant]. +A term can be either a logical @racket[variable] or a @racket[constant]. Thus far, all the terms shown have been constant terms. A query can be used to see if a particular row is in a table. Type this to see if @litchar["john"] is the parent of @litchar["douglas"]: -@schemeinput[#,(tt "parent(john, douglas)?")] -@schemeblock[#,(schemeresultfont (tt "parent(john, douglas)."))] +@racketinput[#,(tt "parent(john, douglas)?")] +@racketblock[#,(racketresultfont (tt "parent(john, douglas)."))] Type this to see if @litchar["john"] is the parent of @litchar["ebbon"]: -@schemeinput[#,(tt "parent(john, ebbon)?")] +@racketinput[#,(tt "parent(john, ebbon)?")] The query produced no results because @litchar["john"] is not the parent of @litchar["ebbon"]. Let's add more rows. -@schemeinput[#,(tt "parent(bob, john).")] -@schemeinput[#,(tt "parent(ebbon, bob).")] +@racketinput[#,(tt "parent(bob, john).")] +@racketinput[#,(tt "parent(ebbon, bob).")] Type the following to list all rows in the @litchar["parent"] table: -@schemeinput[#,(tt "parent(A, B)?")] -@schemeblock[#,(schemeresultfont (tt "parent(john, douglas)."))] -@schemeblock[#,(schemeresultfont (tt "parent(bob, john)."))] -@schemeblock[#,(schemeresultfont (tt "parent(ebbon, bob)."))] +@racketinput[#,(tt "parent(A, B)?")] +@racketblock[#,(racketresultfont (tt "parent(john, douglas)."))] +@racketblock[#,(racketresultfont (tt "parent(bob, john)."))] +@racketblock[#,(racketresultfont (tt "parent(ebbon, bob)."))] Type the following to list all the children of @litchar["john"]: -@schemeinput[#,(tt "parent(john, B)?")] -@schemeblock[#,(schemeresultfont (tt "parent(john, douglas)."))] +@racketinput[#,(tt "parent(john, B)?")] +@racketblock[#,(racketresultfont (tt "parent(john, douglas)."))] A term that begins with a capital letter is a logical variable.When producing a set of answers, the Datalog interpreter lists all rows that match the query when each variable in the query is substituted for a constant. The following example produces no answers, as there are no substitutions for the variable @litchar["A"] that produce a fact in the database. This is because no one is the parent of oneself. -@schemeinput[#,(tt "parent(A, A)?")] +@racketinput[#,(tt "parent(A, A)?")] A deductive database can use rules of inference to derive new facts. Consider the following rule: -@schemeinput[#,(tt "ancestor(A, B) :- parent(A, B).")] +@racketinput[#,(tt "ancestor(A, B) :- parent(A, B).")] The rule says that if A is the parent of B, then A is an ancestor of B. The other rule defining an ancestor says that if A is the parent of C, C is an ancestor of B, then A is an ancestor of B. -@schemeinput[#,(tt "ancestor(A, B) :-") +@racketinput[#,(tt "ancestor(A, B) :-") #,(tt " parent(A, C),") #,(tt " ancestor(C, B).")] @@ -145,34 +143,34 @@ In the interpreter, DrScheme knows that the clause is not complete, so by pressi Rules are used to answer queries just as is done for facts. -@schemeinput[#,(tt "ancestor(A, B)?")] -@schemeblock[#,(schemeresultfont (tt "ancestor(ebbon, bob)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(bob, john)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(john, douglas)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(bob, douglas)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(ebbon, john)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(ebbon, douglas)."))] -@schemeinput[#,(tt "ancestor(X,john)?")] -@schemeblock[#,(schemeresultfont (tt "ancestor(bob, john)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(ebbon, john)."))] +@racketinput[#,(tt "ancestor(A, B)?")] +@racketblock[#,(racketresultfont (tt "ancestor(ebbon, bob)."))] +@racketblock[#,(racketresultfont (tt "ancestor(bob, john)."))] +@racketblock[#,(racketresultfont (tt "ancestor(john, douglas)."))] +@racketblock[#,(racketresultfont (tt "ancestor(bob, douglas)."))] +@racketblock[#,(racketresultfont (tt "ancestor(ebbon, john)."))] +@racketblock[#,(racketresultfont (tt "ancestor(ebbon, douglas)."))] +@racketinput[#,(tt "ancestor(X,john)?")] +@racketblock[#,(racketresultfont (tt "ancestor(bob, john)."))] +@racketblock[#,(racketresultfont (tt "ancestor(ebbon, john)."))] A fact or a rule can be retracted from the database using tilde syntax: -@schemeinput[#,(tt "parent(bob, john)~")] -@schemeinput[#,(tt "parent(A, B)?")] -@schemeblock[#,(schemeresultfont (tt "parent(john, douglas)."))] -@schemeblock[#,(schemeresultfont (tt "parent(ebbon, bob)."))] -@schemeinput[#,(tt "ancestor(A, B)?")] -@schemeblock[#,(schemeresultfont (tt "ancestor(ebbon, bob)."))] -@schemeblock[#,(schemeresultfont (tt "ancestor(john, douglas)."))] +@racketinput[#,(tt "parent(bob, john)~")] +@racketinput[#,(tt "parent(A, B)?")] +@racketblock[#,(racketresultfont (tt "parent(john, douglas)."))] +@racketblock[#,(racketresultfont (tt "parent(ebbon, bob)."))] +@racketinput[#,(tt "ancestor(A, B)?")] +@racketblock[#,(racketresultfont (tt "ancestor(ebbon, bob)."))] +@racketblock[#,(racketresultfont (tt "ancestor(john, douglas)."))] Unlike Prolog, the order in which clauses are asserted is irrelevant. All queries terminate, and every possible answer is derived. -@schemeinput[#,(tt "q(X) :- p(X).")] -@schemeinput[#,(tt "q(a).")] -@schemeinput[#,(tt "p(X) :- q(X).")] -@schemeinput[#,(tt "q(X)?")] -@schemeblock[#,(schemeresultfont (tt "q(a)."))] +@racketinput[#,(tt "q(X) :- p(X).")] +@racketinput[#,(tt "q(a).")] +@racketinput[#,(tt "p(X) :- q(X).")] +@racketinput[#,(tt "q(X)?")] +@racketblock[#,(racketresultfont (tt "q(a)."))] @section{Abstract Syntax} @@ -181,10 +179,10 @@ This library provides the structures that represent Datalog syntax. It can be re @defmodule/this-package[ast] @defthing[srcloc/c contract?]{ - Contract for the third argument to @scheme[datum->syntax]. + Contract for the third argument to @racket[datum->syntax]. Equivalent to - @schemeblock[ + @racketblock[ (or/c syntax? false/c (list/c any/c @@ -197,12 +195,12 @@ This library provides the structures that represent Datalog syntax. It can be re @defthing[datum/c contract?]{ Contract for @deftech{datum}s. - Equivalent to @scheme[(or/c string? symbol?)]. + Equivalent to @racket[(or/c string? symbol?)]. } @defproc[(datum-equal? [d1 datum/c] [d2 datum/c]) boolean?]{ - Equivalent to @scheme[(equal? d1 d2)]. + Equivalent to @racket[(equal? d1 d2)]. @examples[#:eval the-eval (datum-equal? 'sym1 'sym2) @@ -220,7 +218,7 @@ This library provides the structures that represent Datalog syntax. It can be re @defproc[(variable-equal? [v1 variable?] [v2 variable?]) boolean?]{ - Equivalent to @scheme[(equal? v1 v2)] modulo source location. + Equivalent to @racket[(equal? v1 v2)] modulo source location. @examples[#:eval the-eval (variable-equal? (make-variable #f 'sym) @@ -238,7 +236,7 @@ This library provides the structures that represent Datalog syntax. It can be re @defproc[(constant-equal? [c1 constant?] [c2 constant?]) boolean?]{ - Equivalent to @scheme[(equal? c1 c2)] modulo source location. + Equivalent to @racket[(equal? c1 c2)] modulo source location. @examples[#:eval the-eval (constant-equal? (make-constant #f 'sym) @@ -248,12 +246,12 @@ This library provides the structures that represent Datalog syntax. It can be re } @defthing[term/c contract?]{ - Contract for @deftech{term}s. Equivalent to @scheme[(or/c variable? constant?)]. + Contract for @deftech{term}s. Equivalent to @racket[(or/c variable? constant?)]. } @defproc[(term-equal? [t1 term/c] [t2 term/c]) boolean?]{ - Equivalent to @scheme[(equal? t1 t2)] modulo source location. + Equivalent to @racket[(equal? t1 t2)] modulo source location. @examples[#:eval the-eval (term-equal? (make-constant #f 'sym) (make-constant #'sym 'sym)) @@ -268,7 +266,7 @@ This library provides the structures that represent Datalog syntax. It can be re @defproc[(literal-equal? [l1 literal?] [l2 literal?]) boolean?]{ - Equivalent to @scheme[(equal? l1 l2)] modulo source location. + Equivalent to @racket[(equal? l1 l2)] modulo source location. @examples[#:eval the-eval (literal-equal? (make-literal #f 'ancestor (list)) @@ -288,7 +286,7 @@ This library provides the structures that represent Datalog syntax. It can be re @defproc[(clause-equal? [c1 clause?] [c2 clause?]) boolean?]{ - Equivalent to @scheme[(equal? c1 c2)] modulo source location. + Equivalent to @racket[(equal? c1 c2)] modulo source location. @examples[#:eval the-eval (clause-equal? @@ -317,12 +315,12 @@ This library provides the structures that represent Datalog syntax. It can be re @defthing[statement/c contract?]{ Contract for @deftech{statement}s. - Equivalent to @scheme[(or/c assertion? retraction? query?)]. + Equivalent to @racket[(or/c assertion? retraction? query?)]. } @defthing[program/c contract?]{ Contract for @deftech{program}s. - Equivalent to @scheme[(listof statement/c)]. + Equivalent to @racket[(listof statement/c)]. } @section{Lexing and Parsing} @@ -432,7 +430,7 @@ The following BNF describes the syntax of Datalog. @defproc[(parse-literal [ip input-port?]) literal?]{ - Parses a @scheme[literal] from @scheme[ip]. + Parses a @racket[literal] from @racket[ip]. @examples[#:eval the-eval (parse-literal (open-input-string "parent(john,douglas)")) @@ -445,7 +443,7 @@ The following BNF describes the syntax of Datalog. @defproc[(parse-clause [ip input-port?]) clause?]{ - Parses a @scheme[clause] from @scheme[ip]. + Parses a @racket[clause] from @racket[ip]. @examples[#:eval the-eval (parse-clause @@ -460,7 +458,7 @@ The following BNF describes the syntax of Datalog. @defproc[(parse-statement [ip input-port?]) statement/c]{ - Parses a @tech{statement} from @scheme[ip]. + Parses a @tech{statement} from @racket[ip]. @examples[#:eval the-eval (parse-statement @@ -473,7 +471,7 @@ The following BNF describes the syntax of Datalog. @defproc[(parse-program [ip input-port?]) program/c]{ - Parses a @tech{program} from @scheme[ip]. + Parses a @tech{program} from @racket[ip]. @examples[#:eval the-eval (parse-program @@ -494,7 +492,7 @@ This package recognizes an alternative, Scheme-like front-end syntax for Datalog @subsection{Parenthetical Datalog Syntax} -@schemegrammar*[ +@racketgrammar*[ #:literals (:- ! ~ ?) [program (begin statement ...)] [statement assertion @@ -517,30 +515,30 @@ This package recognizes an alternative, Scheme-like front-end syntax for Datalog @defproc[(stx->term [stx syntax?]) term/c]{ - Parses @scheme[stx] as a @tech{term}. + Parses @racket[stx] as a @tech{term}. } @defproc[(stx->literal [stx syntax?]) literal?]{ - Parses @scheme[stx] as a @scheme[literal]. + Parses @racket[stx] as a @racket[literal]. } @defproc[(stx->clause [stx syntax?]) clause?]{ - Parses @scheme[stx] as a @scheme[clause]. + Parses @racket[stx] as a @racket[clause]. } @defproc[(stx->statement [stx syntax?]) statement/c]{ - Parses @scheme[stx] as a @tech{statement}. + Parses @racket[stx] as a @tech{statement}. } @defproc[(stx->program [stx syntax?]) program/c]{ - Parses @scheme[stx] as a @tech{program}. + Parses @racket[stx] as a @tech{program}. } -@defproc[(sexp->term [sexp sexpr?]) term/c]{@scheme[stx->term] composed with @scheme[datum->syntax].} -@defproc[(sexp->literal [sexp sexpr?]) literal?]{@scheme[stx->literal] composed with @scheme[datum->syntax].} -@defproc[(sexp->clause [sexp sexpr?]) clause?]{@scheme[stx->clause] composed with @scheme[datum->syntax].} -@defproc[(sexp->statement [sexp sexpr?]) statement/c]{@scheme[stx->statement] composed with @scheme[datum->syntax].} -@defproc[(sexp->program [sexp sexpr?]) program/c]{@scheme[stx->program] composed with @scheme[datum->syntax].} +@defproc[(sexp->term [sexp sexpr?]) term/c]{@racket[stx->term] composed with @racket[datum->syntax].} +@defproc[(sexp->literal [sexp sexpr?]) literal?]{@racket[stx->literal] composed with @racket[datum->syntax].} +@defproc[(sexp->clause [sexp sexpr?]) clause?]{@racket[stx->clause] composed with @racket[datum->syntax].} +@defproc[(sexp->statement [sexp sexpr?]) statement/c]{@racket[stx->statement] composed with @racket[datum->syntax].} +@defproc[(sexp->program [sexp sexpr?]) program/c]{@racket[stx->program] composed with @racket[datum->syntax].} @section{Pretty-Printing} @@ -550,7 +548,7 @@ This library provides facilities for pretty-printing Datalog source. It can be r This library depends on the @tt{pprint} PLaneT package, which can be required via: -@schemeblock[(require (planet dherman/pprint:4))] +@racketblock[(require (planet dherman/pprint:4))] See the documentation for @tt{pprint} for information on how to use it. @@ -565,7 +563,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-variable [v variable?]) doc?]{ - Formats a @scheme[variable]. + Formats a @racket[variable]. @examples[#:eval the-eval (pretty-print (format-variable (make-variable #f 'Ancestor)))] @@ -573,7 +571,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-constant [c constant?]) doc?]{ - Formats a @scheme[constant]. + Formats a @racket[constant]. @examples[#:eval the-eval (pretty-print (format-constant (make-constant #f 'joseph))) @@ -592,7 +590,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-literal [l literal?]) doc?]{ - Formats a @scheme[literal]. + Formats a @racket[literal]. @examples[#:eval the-eval (pretty-print (format-literal (make-literal #f 'true (list)))) @@ -608,7 +606,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-literals [ls (listof literal?)]) doc?]{ - Formats a list of @scheme[literal]s as @scheme[assertion]s for formatting @scheme[prove] results. + Formats a list of @racket[literal]s as @racket[assertion]s for formatting @racket[prove] results. @examples[#:eval the-eval (pretty-print @@ -623,7 +621,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-clause [c clause?]) doc?]{ - Formats a @scheme[clause]. + Formats a @racket[clause]. @examples[#:eval the-eval (pretty-print @@ -658,7 +656,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-assertion [a assertion?]) doc?]{ - Formats a @scheme[assertion]. + Formats a @racket[assertion]. @examples[#:eval the-eval (pretty-print @@ -673,7 +671,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-retraction [r retraction?]) doc?]{ - Formats a @scheme[retraction]. + Formats a @racket[retraction]. @examples[#:eval the-eval (pretty-print @@ -688,7 +686,7 @@ See the documentation for @tt{pprint} for information on how to use it. @defproc[(format-query [q query?]) doc?]{ - Formats a @scheme[query]. + Formats a @racket[query]. @examples[#:eval the-eval (pretty-print @@ -762,8 +760,8 @@ This library implements the Datalog runtime system. It can be required via: @defproc[(safe-clause? [c clause?]) boolean?]{ - Determines if a @scheme[clause] is safe. - A @scheme[clause] is safe if every @scheme[variable] in its head occurs in some @scheme[literal] in its body. + Determines if a @racket[clause] is safe. + A @racket[clause] is safe if every @racket[variable] in its head occurs in some @racket[literal] in its body. @examples[#:eval the-eval (safe-clause? @@ -779,31 +777,31 @@ This library implements the Datalog runtime system. It can be required via: @defproc[(assume [thy immutable-theory/c] [c safe-clause?]) immutable-theory/c]{ - Adds @scheme[c] to @scheme[thy] in a persistent way. + Adds @racket[c] to @racket[thy] in a persistent way. } @defproc[(retract [thy immutable-theory/c] [c clause?]) immutable-theory/c]{ - Removes @scheme[c] from @scheme[thy] in a persistent way. + Removes @racket[c] from @racket[thy] in a persistent way. } @defproc[(assume! [thy mutable-theory/c] [c safe-clause?]) mutable-theory/c]{ - Adds @scheme[c] to @scheme[thy]. + Adds @racket[c] to @racket[thy]. } @defproc[(retract! [thy mutable-theory/c] [c clause?]) mutable-theory/c]{ - Removes @scheme[c] from @scheme[thy]. + Removes @racket[c] from @racket[thy]. } @defproc[(prove [thy theory/c] [l literal?]) (listof literal?)]{ - Attempts to prove @scheme[l] using the @tech{theory} @scheme[thy], returning all + Attempts to prove @racket[l] using the @tech{theory} @racket[thy], returning all the results of the query. @examples[#:eval the-eval @@ -842,14 +840,14 @@ This library provides facilities for evaluating Datalog. It can be required via: @defmodule/this-package[eval] @defthing[current-theory (parameter/c mutable-theory/c)]{ - The @tech{theory} used by @scheme[eval-program] and @scheme[eval-stmt]. + The @tech{theory} used by @racket[eval-program] and @racket[eval-stmt]. } @defproc[(eval-program [p program/c]) void]{ - Evaluates @scheme[p] using @scheme[(current-theory)] as the @tech{theory}, printing query answers as it goes. + Evaluates @racket[p] using @racket[(current-theory)] as the @tech{theory}, printing query answers as it goes. - This will raise a syntax error if given an @scheme[assertion] of a @scheme[clause] that is not a @scheme[safe-clause?]. + This will raise a syntax error if given an @racket[assertion] of a @racket[clause] that is not a @racket[safe-clause?]. @examples[#:eval the-eval (parameterize ([current-theory (make-mutable-theory)]) @@ -869,9 +867,9 @@ This library provides facilities for evaluating Datalog. It can be required via: @defproc[(eval-statement [s statement/c]) (or/c void (listof literal?))]{ - Evaluates @scheme[s] using @scheme[(current-theory)] as the @tech{theory}. + Evaluates @racket[s] using @racket[(current-theory)] as the @tech{theory}. - This will raise a syntax error if given an @scheme[assertion] of a @scheme[clause] that is not a @scheme[safe-clause?]. + This will raise a syntax error if given an @racket[assertion] of a @racket[clause] that is not a @racket[safe-clause?]. @examples[#:eval the-eval (parameterize ([current-theory (make-mutable-theory)]) @@ -895,9 +893,9 @@ This library provides facilities for evaluating Datalog. It can be required via: @defproc[(eval-program/fresh [p program/c]) immutable-theory/c]{ - Evaluates @scheme[p] in a fresh @tech{theory} and returns the final @tech{theory}, printing query answers as it goes. + Evaluates @racket[p] in a fresh @tech{theory} and returns the final @tech{theory}, printing query answers as it goes. - This will raise a syntax error if given an @scheme[assertion] of a @scheme[clause] that is not a @scheme[safe-clause?]. + This will raise a syntax error if given an @racket[assertion] of a @racket[clause] that is not a @racket[safe-clause?]. @examples[#:eval the-eval (void @@ -919,7 +917,7 @@ This library provides facilities for evaluating Datalog. It can be required via: @section{Acknowledgments} -This package is based on Dave Herman's @schememodname[(planet dherman/javascript)] library and +This package is based on Dave Herman's @racketmodname[(planet dherman/javascript)] library and John Ramsdell's @link["http://www.ccs.neu.edu/home/ramsdell/tools/datalog/datalog.html"]{Datalog library}. The package uses the tabled logic programming algorithm described in diff --git a/collects/datalog/scribblings/utils.rkt b/collects/datalog/scribblings/utils.rkt index f4c281c267..36503e1060 100644 --- a/collects/datalog/scribblings/utils.rkt +++ b/collects/datalog/scribblings/utils.rkt @@ -1,11 +1,10 @@ -#lang scheme/base +#lang racket/base -(require scribble/eval - (planet cce/scheme:6/planet)) +(require scribble/eval) (provide the-eval) (define the-eval (let ([the-eval (make-base-eval)]) - (the-eval `(require (planet ,(this-package-version-symbol)))) + (the-eval `(require datalog)) the-eval)) diff --git a/collects/datalog/sexp.rkt b/collects/datalog/sexp.rkt index 616c28832c..25b6fee89e 100644 --- a/collects/datalog/sexp.rkt +++ b/collects/datalog/sexp.rkt @@ -1,5 +1,5 @@ -#lang scheme -(require "ast.ss") +#lang racket +(require "ast.rkt") (define sexpr? any/c) diff --git a/collects/datalog/tests/ast.rkt b/collects/datalog/tests/ast.rkt index f9f4946211..46b1361386 100644 --- a/collects/datalog/tests/ast.rkt +++ b/collects/datalog/tests/ast.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require schemeunit - "../ast.ss") +#lang racket +(require racketunit + "../ast.rkt") (provide ast-tests) diff --git a/collects/datalog/tests/eval.rkt b/collects/datalog/tests/eval.rkt index 5f7a63881d..706eddc0cc 100644 --- a/collects/datalog/tests/eval.rkt +++ b/collects/datalog/tests/eval.rkt @@ -1,14 +1,14 @@ -#lang scheme -(require schemeunit - scheme/runtime-path - "../parse.ss" - "../eval.ss") +#lang racket +(require racketunit + racket/runtime-path + "../parse.rkt" + "../eval.rkt") (provide eval-tests) (define-runtime-path examples-dir "examples") (define (test-example t) - (define test-ss (build-path examples-dir (format "~a.ss" t))) + (define test-ss (build-path examples-dir (format "~a.rkt" t))) (define test-txt (build-path examples-dir (format "~a.txt" t))) (test-equal? t (filter (lambda (l) diff --git a/collects/datalog/tests/examples/tutorial.rkt b/collects/datalog/tests/examples/tutorial.rkt index 161947d7d5..12f79c5c82 100644 --- a/collects/datalog/tests/examples/tutorial.rkt +++ b/collects/datalog/tests/examples/tutorial.rkt @@ -1,4 +1,4 @@ -#lang planet jaymccarthy/datalog +#lang palsdatalog parent(john,douglas). parent(john,douglas)? diff --git a/collects/datalog/tests/main.rkt b/collects/datalog/tests/main.rkt index 35fa2ba469..1d782574c6 100644 --- a/collects/datalog/tests/main.rkt +++ b/collects/datalog/tests/main.rkt @@ -1,23 +1,23 @@ -#lang scheme -(require schemeunit - schemeunit/text-ui - "ast.ss" +#lang racket +(require racketunit + racketunit/text-ui + "ast.rkt" - "private/lex.ss" - "drscheme/syntax-color.ss" - "parse.ss" - "sexp.ss" + "private/lex.rkt" + "tool/syntax-color.rkt" + "parse.rkt" + "sexp.rkt" - "pretty.ss" + "pretty.rkt" - "private/env.ss" - "private/subst.ss" - "private/unify.ss" - "private/variant.ss" + "private/env.rkt" + "private/subst.rkt" + "private/unify.rkt" + "private/variant.rkt" - "runtime.ss" - "eval.ss" - "private/compiler.ss") + "runtime.rkt" + "eval.rkt" + "private/compiler.rkt") (run-tests (test-suite diff --git a/collects/datalog/tests/parse.rkt b/collects/datalog/tests/parse.rkt index ae72178d5a..dd05630b8c 100644 --- a/collects/datalog/tests/parse.rkt +++ b/collects/datalog/tests/parse.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit - "../ast.ss" - "util.ss" - "../parse.ss") +#lang racket +(require racketunit + "../ast.rkt" + "util.rkt" + "../parse.rkt") (provide parse-tests) diff --git a/collects/datalog/tests/pretty.rkt b/collects/datalog/tests/pretty.rkt index e633f2a449..ff3a053f1f 100644 --- a/collects/datalog/tests/pretty.rkt +++ b/collects/datalog/tests/pretty.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit +#lang racket +(require racketunit (planet dherman/pprint:4) - "../parse.ss" - "../pretty.ss") + "../parse.rkt" + "../pretty.rkt") (provide pretty-tests) (define pretty-tests diff --git a/collects/datalog/tests/private/compiler.rkt b/collects/datalog/tests/private/compiler.rkt index 6b2f4250c6..052e616568 100644 --- a/collects/datalog/tests/private/compiler.rkt +++ b/collects/datalog/tests/private/compiler.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit - (for-template "../../eval.ss") - "../../parse.ss" - "../../private/compiler.ss") +#lang racket +(require racketunit + (for-template "../../eval.rkt") + "../../parse.rkt" + "../../private/compiler.rkt") (provide compiler-tests) diff --git a/collects/datalog/tests/private/env.rkt b/collects/datalog/tests/private/env.rkt index 8e8c61f840..8a86e50faf 100644 --- a/collects/datalog/tests/private/env.rkt +++ b/collects/datalog/tests/private/env.rkt @@ -1,7 +1,7 @@ -#lang scheme -(require schemeunit - "../../ast.ss" - "../../private/env.ss") +#lang racket +(require racketunit + "../../ast.rkt" + "../../private/env.rkt") (provide env-tests) diff --git a/collects/datalog/tests/private/lex.rkt b/collects/datalog/tests/private/lex.rkt index 1f3874a2f0..72776c8db9 100644 --- a/collects/datalog/tests/private/lex.rkt +++ b/collects/datalog/tests/private/lex.rkt @@ -1,7 +1,7 @@ -#lang scheme -(require schemeunit +#lang racket +(require racketunit parser-tools/lex - "../../private/lex.ss") + "../../private/lex.rkt") (provide lex-tests) diff --git a/collects/datalog/tests/private/subst.rkt b/collects/datalog/tests/private/subst.rkt index a489e28bd6..d475348645 100644 --- a/collects/datalog/tests/private/subst.rkt +++ b/collects/datalog/tests/private/subst.rkt @@ -1,9 +1,9 @@ -#lang scheme -(require schemeunit - "../../private/subst.ss" - "../../ast.ss" - "../../private/env.ss") -(require/expose "../../private/subst.ss" (subst-literal shuffle)) +#lang racket +(require racketunit + "../../private/subst.rkt" + "../../ast.rkt" + "../../private/env.rkt") +(require/expose "../../private/subst.rkt" (subst-literal shuffle)) (provide subst-tests) diff --git a/collects/datalog/tests/private/unify.rkt b/collects/datalog/tests/private/unify.rkt index fd45e1e902..db37e61589 100644 --- a/collects/datalog/tests/private/unify.rkt +++ b/collects/datalog/tests/private/unify.rkt @@ -1,9 +1,9 @@ -#lang scheme -(require schemeunit - "../../ast.ss" - "../../private/env.ss" - "../../private/unify.ss") -(require/expose "../../private/unify.ss" (chase unify-terms)) +#lang racket +(require racketunit + "../../ast.rkt" + "../../private/env.rkt" + "../../private/unify.rkt") +(require/expose "../../private/unify.rkt" (chase unify-terms)) (provide unify-tests) diff --git a/collects/datalog/tests/private/variant.rkt b/collects/datalog/tests/private/variant.rkt index b7a16007b9..1c28fbd597 100644 --- a/collects/datalog/tests/private/variant.rkt +++ b/collects/datalog/tests/private/variant.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit - "../../ast.ss" - "../../private/variant.ss") -(require/expose "../../private/variant.ss" (variant-terms variant-term variant-var variant? term-hash mk-literal-hash)) +#lang racket +(require racketunit + "../../ast.rkt" + "../../private/variant.rkt") +(require/expose "../../private/variant.rkt" (variant-terms variant-term variant-var variant? term-hash mk-literal-hash)) (provide variant-tests) diff --git a/collects/datalog/tests/runtime.rkt b/collects/datalog/tests/runtime.rkt index d7d77ee790..0727dd5d78 100644 --- a/collects/datalog/tests/runtime.rkt +++ b/collects/datalog/tests/runtime.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit - "../parse.ss" - "util.ss" - "../runtime.ss") +#lang racket +(require racketunit + "../parse.rkt" + "util.rkt" + "../runtime.rkt") (provide runtime-tests) diff --git a/collects/datalog/tests/sexp.rkt b/collects/datalog/tests/sexp.rkt index 3e381ff3a9..64e34807f7 100644 --- a/collects/datalog/tests/sexp.rkt +++ b/collects/datalog/tests/sexp.rkt @@ -1,8 +1,8 @@ -#lang scheme -(require schemeunit - "../ast.ss" - "util.ss" - "../sexp.ss") +#lang racket +(require racketunit + "../ast.rkt" + "util.rkt" + "../sexp.rkt") (provide sexp-tests) diff --git a/collects/datalog/tests/tool/syntax-color.rkt b/collects/datalog/tests/tool/syntax-color.rkt index 9c411a3cc3..3d251d65b0 100644 --- a/collects/datalog/tests/tool/syntax-color.rkt +++ b/collects/datalog/tests/tool/syntax-color.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require schemeunit - "../../drscheme/syntax-color.ss") +#lang racket +(require racketunit + "../../tool/syntax-color.rkt") (provide syntax-color-tests) diff --git a/collects/datalog/tests/util.rkt b/collects/datalog/tests/util.rkt index 277ca24ed7..6787d94264 100644 --- a/collects/datalog/tests/util.rkt +++ b/collects/datalog/tests/util.rkt @@ -1,6 +1,6 @@ -#lang scheme -(require schemeunit - "../ast.ss") +#lang racket +(require racketunit + "../ast.rkt") (provide test-literal test-clause) diff --git a/collects/datalog/tool/info.rkt b/collects/datalog/tool/info.rkt index fcbc167a87..8e536d9afa 100644 --- a/collects/datalog/tool/info.rkt +++ b/collects/datalog/tool/info.rkt @@ -1,6 +1,6 @@ #lang setup/infotab -(define name "Datalog Language for DrScheme") -(define tools '(("tool.ss"))) +(define name "Datalog Language for Racket") +(define tools '(("tool.rkt"))) (define tool-icons '("datalog.png")) (define tool-names '("Datalog")) (define tool-urls '("http://en.wikipedia.org/wiki/Datalog")) diff --git a/collects/datalog/tool/module-forms.rkt b/collects/datalog/tool/module-forms.rkt index 3141369962..72a6e046f9 100644 --- a/collects/datalog/tool/module-forms.rkt +++ b/collects/datalog/tool/module-forms.rkt @@ -1,4 +1,4 @@ -#lang scheme/base - -;; provided names required by the user module's namespace -(provide #%top #%datum) +#lang racket/base + +;; provided names required by the user module's namespace +(provide #%top #%datum) diff --git a/collects/datalog/tool/syntax-color.rkt b/collects/datalog/tool/syntax-color.rkt index c81e3e4cf7..6078175a40 100644 --- a/collects/datalog/tool/syntax-color.rkt +++ b/collects/datalog/tool/syntax-color.rkt @@ -1,7 +1,7 @@ -#lang scheme +#lang racket (require parser-tools/lex (prefix-in : parser-tools/lex-sre) - "../private/lex.ss") + "../private/lex.rkt") (provide get-syntax-token) diff --git a/collects/datalog/tool/tool.rkt b/collects/datalog/tool/tool.rkt index 2f2fe92385..5e066616ab 100644 --- a/collects/datalog/tool/tool.rkt +++ b/collects/datalog/tool/tool.rkt @@ -1,36 +1,35 @@ -#lang scheme -(require (planet cce/scheme:6/planet)) -(require scheme/gui/base +#lang racket +(require racket/gui/base framework - drscheme/tool - scheme/match - scheme/unit - scheme/class + drracket/tool + racket/match + racket/unit + racket/class string-constants - "syntax-color.ss" - "../private/compiler.ss" - "../parse.ss" - "../pretty.ss" - "../eval.ss" - "../runtime.ss" + "syntax-color.rkt" + "../private/compiler.rkt" + "../parse.rkt" + "../pretty.rkt" + "../eval.rkt" + "../runtime.rkt" (only-in (planet dherman/pprint:4) pretty-print) - (for-template "../lang/lang.ss")) + (for-template "../lang/lang.rkt")) (provide tool@) (define tool@ (unit - (import drscheme:tool^) - (export drscheme:tool-exports^) + (import drracket:tool^) + (export drracket:tool-exports^) (define (phase1) (void)) (define (phase2) - (drscheme:language-configuration:add-language - (make-object ((drscheme:language:get-default-mixin) + (drracket:language-configuration:add-language + (make-object ((drracket:language:get-default-mixin) (datalog-lang-mixin))))) (define (datalog-lang-mixin) - (class* object% (drscheme:language:language<%>) + (class* object% (drracket:language:language<%>) (define/public (default-settings) #f) (define/public (default-settings? x) (false? x)) (define/public (marshall-settings x) x) @@ -41,19 +40,19 @@ (define/public (get-metadata-lines) #f) (define/public (capability-value capability) (case capability - [(drscheme:check-syntax-button) #t] - [(drscheme:language-menu-title) "Datalog"] - [(drscheme:define-popup) #f] - [(drscheme:special:insert-fraction) #f] - [(drscheme:special:insert-lambda) #f] - [(drscheme:special:insert-large-letters) #t] - [(drscheme:special:insert-image) #f] - [(drscheme:special:insert-comment-box) #f] - [(drscheme:special:insert-gui-tool) #f] - [(drscheme:special:slideshow-menu-item) #f] - [(drscheme:special:insert-text-box) #f] - [(drscheme:special:xml-menus) #f] - [else (drscheme:language:get-capability-default capability)])) + [(drracket:check-syntax-button) #t] + [(drracket:language-menu-title) "Datalog"] + [(drracket:define-popup) #f] + [(drracket:special:insert-fraction) #f] + [(drracket:special:insert-lambda) #f] + [(drracket:special:insert-large-letters) #t] + [(drracket:special:insert-image) #f] + [(drracket:special:insert-comment-box) #f] + [(drracket:special:insert-gui-tool) #f] + [(drracket:special:slideshow-menu-item) #f] + [(drracket:special:insert-text-box) #f] + [(drracket:special:xml-menus) #f] + [else (drracket:language:get-capability-default capability)])) (define/public (first-opened) (void)) (define/public (get-comment-character) (values "%" #\*)) (define/public (config-panel parent) @@ -92,7 +91,7 @@ (define/public (get-language-numbers) (list 1000 42)) (define/public (get-teachpack-names) null) (define/public (on-execute settings run-in-user-thread) - (let ([module-forms `(planet ,(this-package-version-symbol drscheme/module-forms))] + (let ([module-forms `(planet ,(this-package-version-symbol drracket/module-forms))] [runtime `(planet ,(this-package-version-symbol eval))] [lang `(planet ,(this-package-version-symbol lang/lang))]) (dynamic-require module-forms #f) @@ -104,7 +103,7 @@ [n (current-namespace)]) (run-in-user-thread (lambda () - (let ([previous-eval (drscheme:debug:make-debug-eval-handler (current-eval))]) + (let ([previous-eval (drracket:debug:make-debug-eval-handler (current-eval))]) (current-eval (lambda (exp) (previous-eval (if (syntax? exp) @@ -140,7 +139,7 @@ ;; short-sym->style-name : symbol->string ;; converts the short name (from the table above) into a name in the editor list ;; (they are added in by `color-prefs:register-color-pref', called below) - (define (short-sym->style-name sym) (format "datalog:syntax-colors:scheme:~a" sym)) + (define (short-sym->style-name sym) (format "datalog:syntax-colors:racket:~a" sym)) (define color-prefs-table `((keyword ,(make-object color% 38 38 128) "keyword") @@ -192,7 +191,7 @@ (define (delimiter-pair? x y) (and (char=? x #\() (char=? y #\)))) - ;; repl-submit? : drscheme:rep:text<%> nat -> boolean? + ;; repl-submit? : drracket:rep:text<%> nat -> boolean? (define (repl-submit? text prompt-position) (let loop ([i prompt-position] [blank? #t] @@ -242,7 +241,7 @@ delimiter-stack closed?)])))) - (drscheme:modes:add-mode "Datalog mode" mode-surrogate repl-submit? matches-language?) + (drracket:modes:add-mode "Datalog mode" mode-surrogate repl-submit? matches-language?) (color-prefs:add-to-preferences-panel "Datalog" extend-preferences-panel) (for ([line color-prefs-table])