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/pythonesque-demo/grammar.rkt

15 lines
414 B
Racket

#lang brag
7 years ago
top : statement*
@statement : func-def | expr | return | if
func-def : /"def" var /"(" ids /")" /":" block
7 years ago
/ids : [var (/"," var)*]
7 years ago
block : /INDENT statement* /DEDENT
@expr : comparison
7 years ago
comparison : [comparison "<"] value
7 years ago
@value : var | INT | func-app | STRING
func-app : var /"(" exprs /")"
@exprs : [expr (/"," expr)*]
return : /"return" expr
if : /"if" expr /":" block [/"else" /":" block]
7 years ago
@var : ID