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

12 lines
328 B
Racket

6 years ago
#lang brag
top : (fun | app)*
fun : /"fun" var /"(" argvars /")" /"=" expr
/argvars : [var (/"," var)*]
5 years ago
@expr : add-or-sub
add-or-sub : [add-or-sub ("+" | "-")] mult-or-div
mult-or-div : [mult-or-div ("*" | "/")] value
5 years ago
@value : var | int | app | /"(" expr /")"
int : ["-"] INT
app : var /"(" [expr (/"," expr)*] /")"
6 years ago
@var : ID