From 0bda9efa9650cc5ddd73f42244e3a91f67799f66 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 25 Jun 2010 22:04:55 -0600 Subject: [PATCH] Removing old sexp library and correct docs for warning --- collects/datalog/main.rkt | 2 - collects/datalog/scribblings/racket.scrbl | 35 +---------- collects/datalog/sexp.rkt | 72 ----------------------- collects/tests/datalog/main.rkt | 6 +- collects/tests/datalog/sexp.rkt | 49 --------------- 5 files changed, 3 insertions(+), 161 deletions(-) delete mode 100644 collects/datalog/sexp.rkt delete mode 100644 collects/tests/datalog/sexp.rkt diff --git a/collects/datalog/main.rkt b/collects/datalog/main.rkt index 3d4186d1c6..1876c576cd 100644 --- a/collects/datalog/main.rkt +++ b/collects/datalog/main.rkt @@ -1,13 +1,11 @@ #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/scribblings/racket.scrbl b/collects/datalog/scribblings/racket.scrbl index 2ade2a8add..484bdd694a 100644 --- a/collects/datalog/scribblings/racket.scrbl +++ b/collects/datalog/scribblings/racket.scrbl @@ -10,7 +10,7 @@ @title{Racket Interoperability} -@defmodule[datalog] +@defmodule[datalog/main] The Datalog database can be directly used by Racket programs through this API. @@ -253,39 +253,6 @@ This library provides facilities for parsing Datalog source. It can be required "path(X, Y)?")))] } -@section{Parenthetical Datalog Parsing} - -This package recognizes an alternative, Scheme-like front-end syntax for Datalog. It can be required via: - -@defmodule[datalog/sexp] - -@defproc[(stx->term [stx syntax?]) - term/c]{ - Parses @racket[stx] as a @tech{term}. -} -@defproc[(stx->literal [stx syntax?]) - literal?]{ - Parses @racket[stx] as a @racket[literal]. -} -@defproc[(stx->clause [stx syntax?]) - clause?]{ - Parses @racket[stx] as a @racket[clause]. -} -@defproc[(stx->statement [stx syntax?]) - statement/c]{ - Parses @racket[stx] as a @tech{statement}. -} -@defproc[(stx->program [stx syntax?]) - program/c]{ - Parses @racket[stx] as a @tech{program}. -} - -@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} This library provides facilities for pretty-printing Datalog source. It can be required via: diff --git a/collects/datalog/sexp.rkt b/collects/datalog/sexp.rkt deleted file mode 100644 index 25b6fee89e..0000000000 --- a/collects/datalog/sexp.rkt +++ /dev/null @@ -1,72 +0,0 @@ -#lang racket -(require "ast.rkt") - -(define sexpr? any/c) - -(define (sexp-wrap s->) - (lambda (sexp) - (s-> (datum->syntax #f sexp #f)))) - -(define (stx->program stx) - (syntax-case stx (begin) - [(begin s ...) - (map stx->statement (syntax->list #'(s ...)))])) -(define sexp->program (sexp-wrap stx->program)) - -(define (stx->statement stx) - (syntax-case stx (! ~ ?) - [(! c) - (make-assertion stx (stx->clause #'c))] - [(~ c) - (make-retraction stx (stx->clause #'c))] - [(? l) - (make-query stx (stx->literal #'l))])) -(define sexp->statement (sexp-wrap stx->statement)) - -(define (stx->clause stx) - (syntax-case stx (:-) - [(:- l body ...) - (make-clause stx (stx->literal #'l) - (map stx->literal (syntax->list #'(body ...))))] - [l - (make-clause stx (stx->literal #'l) empty)])) -(define sexp->clause (sexp-wrap stx->clause)) - -(define (stx->literal stx) - (syntax-case stx () - [(p t ...) - (make-literal - stx (stx->datum #'p) - (map stx->term (syntax->list #'(t ...))))])) -(define sexp->literal (sexp-wrap stx->literal)) - -(define (stx->term stx) - (syntax-case stx (unquote) - [(unquote d) - (identifier? #'d) - (make-variable stx (syntax->datum #'d))] - [d - (datum-syntax? #'d) - (make-constant stx (stx->datum #'d))])) -(define sexp->term (sexp-wrap stx->term)) - -(define (datum-syntax? stx) - (define d (syntax->datum stx)) - (or (symbol? d) (string? d))) -(define (stx->datum stx) - (syntax-case stx () - [d - (datum-syntax? #'d) - (syntax->datum #'d)])) - -(provide/contract - [stx->program (syntax? . -> . program/c)] - [stx->statement (syntax? . -> . statement/c)] - [stx->clause (syntax? . -> . clause?)] - [stx->literal (syntax? . -> . literal?)] - [stx->term (syntax? . -> . term/c)] - [sexp->program (sexpr? . -> . program/c)] - [sexp->statement (sexpr? . -> . statement/c)] - [sexp->clause (sexpr? . -> . clause?)] - [sexp->literal (sexpr? . -> . literal?)] - [sexp->term (sexpr? . -> . term/c)]) \ No newline at end of file diff --git a/collects/tests/datalog/main.rkt b/collects/tests/datalog/main.rkt index 739863082c..2f5b15bb64 100644 --- a/collects/tests/datalog/main.rkt +++ b/collects/tests/datalog/main.rkt @@ -5,8 +5,7 @@ "private/lex.rkt" "tool/syntax-color.rkt" - "parse.rkt" - "sexp.rkt" + "parse.rkt" "pretty.rkt" @@ -26,8 +25,7 @@ lex-tests syntax-color-tests - parse-tests - sexp-tests + parse-tests pretty-tests diff --git a/collects/tests/datalog/sexp.rkt b/collects/tests/datalog/sexp.rkt deleted file mode 100644 index 8a027b442a..0000000000 --- a/collects/tests/datalog/sexp.rkt +++ /dev/null @@ -1,49 +0,0 @@ -#lang racket -(require rackunit - datalog/ast - datalog/sexp - "util.rkt") - -(provide sexp-tests) - -(define test - #'(begin - (! (parent john douglas)) - (? (parent john douglas)) - (? (parent john ebbon)) - (! (parent bob john)) - (! (parent ebbon bob)) - (? (parent ,A ,B)) - (? (parent john ,B)) - (? (parent ,A ,A)) - (! (:- (ancestor ,A ,B) - (parent ,A ,B))) - (! (:- (ancestor ,A ,B) - (parent ,A ,C) - (ancestor ,C ,B))) - (? (ancestor ,A ,B)) - (? (ancestor ,X john)) - (~ (parent bob john)) - (? (parent ,A ,B)) - (? (ancestor ,A ,B)))) - -(define sexp-tests - (test-suite - "sexp" - - (test-not-exn "program" (lambda () (contract program/c (stx->program test) 'pos 'neg))) - - (test-not-false "stmt" (assertion? (stx->statement #'(! (parent john douglas))))) - (test-not-false "stmt" (retraction? (stx->statement #'(~ (parent john douglas))))) - (test-not-false "stmt" (query? (stx->statement #'(? (parent john douglas))))) - - (test-clause "clause" (stx->clause #'(parent john douglas)) - (make-clause #f (make-literal #f 'parent (list (make-constant #f 'john) (make-constant #f 'douglas))) empty)) - (test-clause "clause" (stx->clause #'(:- (ancestor ,A ,B) (parent ,A ,B))) - (make-clause #f (make-literal #f 'ancestor (list (make-variable #f 'A) (make-variable #f 'B))) - (list (make-literal #f 'parent (list (make-variable #f 'A) (make-variable #f 'B)))))) - - (test-literal "literal" (stx->literal #'(parent john douglas)) - (make-literal #f 'parent (list (make-constant #f 'john) (make-constant #f 'douglas)))) - - )) \ No newline at end of file