fix negativity

pull/23/head
Matthew Butterick 6 years ago
parent 83206c4521
commit 9c168fbd98

@ -6,6 +6,7 @@ fun : /"fun" var /"(" argvars /")" /"=" expr
@expr : add-or-sub
add-or-sub : [add-or-sub ("+" | "-")] mult-or-div
mult-or-div : [mult-or-div ("*" | "/")] value
@value : var | INT | app | /"(" expr /")"
@value : var | int | app | /"(" expr /")"
int : ["-"] INT
app : var /"(" [expr (/"," expr)*] /")"
@var : ID

@ -1,6 +1,6 @@
#lang br/quicklang
(require brag/support "grammar.rkt")
(provide top fun app add-or-sub mult-or-div)
(provide top fun app add-or-sub mult-or-div int)
(module+ reader
(provide read-syntax))
@ -34,6 +34,10 @@
[(_ LEFT "/" RIGHT) #'(/ LEFT RIGHT)]
[(_ OTHER) #'OTHER])
(define-macro-cases int
[(_ VAL) #'VAL]
[(_ "-" VAL) #'(- VAL)])
(define-macro app #'#%app)
(define (read-syntax src ip)

Loading…
Cancel
Save