add contracts

dev-srcloc
Matthew Butterick 8 years ago
parent 1f8e1520da
commit 6184ebb3e1

@ -1,6 +1,10 @@
#lang br/quicklang
(require "tokenizer.rkt" "parser.rkt")
(define (read-syntax path port)
(define (syntax-no-bindings? stx)
(and (syntax? stx)
(equal? stx (strip-bindings stx))))
(define/contract (read-syntax path port)
(path? input-port? . -> . syntax?)
(define parse-tree (parse path (tokenize port)))
(define module-datum `(module jsonic-module br/demo/jsonic/expander
,parse-tree))

@ -1,7 +1,13 @@
#lang br/quicklang
(require brag/support)
(define (tokenize port)
(define (next-token)
(define (token? x)
(or (eof-object? x) (string? x) (token-struct? x)))
(define/contract (tokenize port)
(input-port? . -> . (-> token?))
(define/contract (next-token)
(-> token?)
(define our-lexer
(lexer
[(eof) eof]

Loading…
Cancel
Save