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.
15 lines
414 B
Racket
15 lines
414 B
Racket
#lang brag
|
|
|
|
top : statement*
|
|
@statement : func-def | expr | return | if
|
|
func-def : /"def" var /"(" ids /")" /":" block
|
|
/ids : [var (/"," var)*]
|
|
block : /INDENT statement* /DEDENT
|
|
@expr : comparison
|
|
comparison : [comparison "<"] value
|
|
@value : var | INT | func-app | STRING
|
|
func-app : var /"(" exprs /")"
|
|
@exprs : [expr (/"," expr)*]
|
|
return : /"return" expr
|
|
if : /"if" expr /":" block [/"else" /":" block]
|
|
@var : ID |