Added support for sweet-expressions

* Moved cur.rkt to main.rkt, which fixes some reader issues
* Added sweet-expression tests
* Added notes about sweet-expressions to README
* Added sweet-exp as dependency to tests
This commit is contained in:
William J. Bowman 2016-03-17 16:59:54 -04:00
parent 4f272dc507
commit b8ca2ad9dc
No known key found for this signature in database
GPG Key ID: DDD48D26958F0D1A
16 changed files with 47 additions and 15 deletions

View File

@ -52,6 +52,22 @@ Try entering the following in the interaction area:
(sub1 (s (s z))) (sub1 (s (s z)))
``` ```
Don't like parenthesis? Use Cur with sweet-expressions:
```racket
#lang sweet-exp
require
cur/stdlib/bool
cur/stdlib/nat
if true
false
true
define + plus
{z + s(z)}
```
See the docs: `raco docs cur`. See the docs: `raco docs cur`.
Going further Going further

View File

@ -1,2 +1,2 @@
#lang s-exp syntax/module-reader #lang s-exp syntax/module-reader
cur/cur cur

View File

@ -1,4 +1,4 @@
#lang s-exp "cur.rkt" #lang s-exp "main.rkt"
;; Olly: The OTT-Like LibrarY ;; Olly: The OTT-Like LibrarY
;; TODO: Automagically create a parser from bnf grammar ;; TODO: Automagically create a parser from bnf grammar
(require (require
@ -6,7 +6,7 @@
"stdlib/nat.rkt" "stdlib/nat.rkt"
;; TODO: "real-"? More like "curnel-" ;; TODO: "real-"? More like "curnel-"
(only-in (only-in
"cur.rkt" "main.rkt"
[#%app real-app] [#%app real-app]
[elim real-elim] [elim real-elim]
[Π real-forall] [Π real-forall]

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require "sugar.rkt") (require "sugar.rkt")
(provide Bool true false if not and or) (provide Bool true false if not and or)

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require (require
"nat.rkt" "nat.rkt"
"maybe.rkt" "maybe.rkt"

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require "sugar.rkt") (require "sugar.rkt")
(provide Maybe none some some/i) (provide Maybe none some some/i)

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require "sugar.rkt" "bool.rkt") (require "sugar.rkt" "bool.rkt")
;; TODO: override (all-defined-out) to enable exporting all these ;; TODO: override (all-defined-out) to enable exporting all these
;; properly. ;; properly.

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require "sugar.rkt") (require "sugar.rkt")
;; TODO: Handle multiple provide forms properly ;; TODO: Handle multiple provide forms properly
;; TODO: Handle (all-defined-out) properly ;; TODO: Handle (all-defined-out) properly

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(provide (provide
-> ->
lambda lambda
@ -27,7 +27,7 @@
query-type) query-type)
(require (require
(only-in "../cur.rkt" (only-in "../main.rkt"
[elim real-elim] [elim real-elim]
[#%app real-app] [#%app real-app]
[λ real-lambda] [λ real-lambda]

View File

@ -1,4 +1,4 @@
#lang s-exp "../../cur.rkt" #lang s-exp "../../main.rkt"
(require (require
(for-syntax racket/syntax)) (for-syntax racket/syntax))
(provide (provide

View File

@ -1,4 +1,4 @@
#lang s-exp "../../cur.rkt" #lang s-exp "../../main.rkt"
(require (require
"base.rkt" "base.rkt"
(prefix-in basic: "standard.rkt") (prefix-in basic: "standard.rkt")

View File

@ -1,4 +1,4 @@
#lang s-exp "../../cur.rkt" #lang s-exp "../../main.rkt"
(require (require
"base.rkt" "base.rkt"
(for-syntax racket/syntax)) (for-syntax racket/syntax))

View File

@ -1,4 +1,4 @@
#lang s-exp "../cur.rkt" #lang s-exp "../main.rkt"
(require (require
"nat.rkt" "nat.rkt"
"bool.rkt" "bool.rkt"

View File

@ -0,0 +1,16 @@
#lang sweet-exp cur
require
cur/stdlib/sugar
cur/stdlib/bool
cur/stdlib/nat
rackunit
check-equal?
if true false true
false
define + plus
check-equal?
{z + s(z)}
s(z)

View File

@ -1,7 +1,7 @@
#lang info #lang info
(define collection 'multi) (define collection 'multi)
(define deps '()) (define deps '())
(define build-deps '("base" "rackunit-lib" ("cur-lib" #:version "0.2"))) (define build-deps '("base" "rackunit-lib" ("cur-lib" #:version "0.2") "sweet-exp"))
(define update-implies '("cur-lib")) (define update-implies '("cur-lib"))
(define pkg-desc "Tests for \"cur\".") (define pkg-desc "Tests for \"cur\".")
(define pkg-authors '(wilbowma)) (define pkg-authors '(wilbowma))