fix grammar

dev-elider-3
Matthew Butterick 9 years ago
parent 3efb3b7f2b
commit e42afcd5df

@ -103,6 +103,10 @@
(define (basic:and . args) (cond->int (andmap true? args))) (define (basic:and . args) (cond->int (andmap true? args)))
(define (basic:or . args) (cond->int (ormap true? args))) (define (basic:or . args) (cond->int (ormap true? args)))
(define-cases #'expr-list
[#'(_ _EXPR) #'_EXPR]
[#'(_ _EXPR "," _EXPR-LIST) #'(_EXPR _EXPR-LIST)])
(define-cases #'expr (define-cases #'expr
[#'(_ _COMP-EXPR "AND" _SUBEXPR) #'(basic:and _COMP-EXPR _SUBEXPR)] [#'(_ _COMP-EXPR "AND" _SUBEXPR) #'(basic:and _COMP-EXPR _SUBEXPR)]
[#'(_ _COMP-EXPR "OR" _SUBEXPR) #'(basic:or _COMP-EXPR _SUBEXPR)] [#'(_ _COMP-EXPR "OR" _SUBEXPR) #'(basic:or _COMP-EXPR _SUBEXPR)]
@ -121,9 +125,9 @@
[#'(_ _TERM) #'_TERM]) [#'(_ _TERM) #'_TERM])
(define-cases #'product (define-cases #'product
[#'(_ _FACTOR "*" _PRODUCT) #'(* _FACTOR _PRODUCT)] [#'(_ _value "*" _product) #'(* _value _product)]
[#'(_ _FACTOR "/" _PRODUCT) #'(/ _FACTOR _PRODUCT)] [#'(_ _value "/" _product) #'(/ _value _product)]
[#'(_ _FACTOR) #'_FACTOR]) [#'(_ _value) #'_value])
(define print-list list) (define print-list list)

@ -26,7 +26,9 @@ sum : product [("+" | "-") sum]
product : value [("*" | "/") product] product : value [("*" | "/") product]
value : ID ["(" expr* ")"] expr-list : expr ["," expr-list]*
value : ID ["(" expr-list ")"]
| "(" expr ")" | "(" expr ")"
| STRING | STRING
| NUMBER | NUMBER

Loading…
Cancel
Save