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
420 B
Racket
15 lines
420 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 | INTEGER | func-app | STRING
|
|
func-app : var /"(" @exprs /")"
|
|
exprs : [expr (/"," expr)*]
|
|
return : /"return" expr
|
|
if : /"if" expr /":" block [/"else" /":" block]
|
|
@var : ID |