grino/doc/grammar.bnf

28 lines
525 B
BNF

MODULE ::= EXPR*
EXPR ::=
bool
| int
| ident
| float
| string
| VARDECL
| FUNDECL
| FUNCALL
| LAMBDA
| BLOCK
| ARRAY
| IMPORT
| SHORT_IMPORT
| NS
VARDECL ::= opar decl ident EXPR cpar
FUNDECL ::= opar decl opar ident* cpar BODY cpar
FUNCALL ::= opar EXPR EXPR* cpar
LAMBDA ::= opar lambda opar PARAMS cpar BODY cpar
PARAMS ::= ident*
BODY ::= EXPR*
BLOCK ::= opar colon EXPR* cpar
ARRAY ::= osquare EXPR* csquare
IMPORT ::= opar import string cpar
SHORT_IMPORT ::= opar decl import ident string cpar
NS ::= ident ns ident