update algebra & precalc demos
parent
684abfc3e6
commit
06a0c155ab
@ -1,6 +1,6 @@
|
||||
#lang algebra-demo
|
||||
fun f(x,y) = x + y
|
||||
% fun f(x,y) = x * y
|
||||
# fun f(x,y) = x * y
|
||||
fun g(zz) = f(zz,zz)
|
||||
g(10)
|
||||
g(23)
|
@ -1,11 +1,11 @@
|
||||
#lang brag
|
||||
|
||||
top : (func-def | func-app)*
|
||||
func-def : /"fun" var /"(" vars /")" /"=" expr
|
||||
/vars : [var (/"," var)*]
|
||||
@expr : sum
|
||||
sum : [sum ("+" | "-")] product
|
||||
product : [product ("*" | "/")] value
|
||||
@value : var | INT | func-app | /"(" expr /")"
|
||||
func-app : var /"(" [expr (/"," expr)*] /")"
|
||||
top : (fun | app)*
|
||||
fun : /"fun" var /"(" argvars /")" /"=" expr
|
||||
/argvars : [var (/"," var)*]
|
||||
@expr : s-or-d
|
||||
s-or-d : [s-or-d ("+" | "-")] p-or-q
|
||||
p-or-q : [p-or-q ("*" | "/")] value
|
||||
@value : var | INT | app | /"(" expr /")"
|
||||
app : var /"(" [expr (/"," expr)*] /")"
|
||||
@var : ID
|
Loading…
Reference in New Issue