You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket-demo/precalc-demo/grammar.rkt

11 lines
311 B
Racket

7 years ago
#lang brag
top : (fun | app)*
fun : /"fun" var /"(" argvars /")" /"=" expr
/argvars : [var (/"," var)*]
6 years ago
@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 /")"
app : var /"(" [expr (/"," expr)*] /")"
7 years ago
@var : ID