dust-bunny/src/dust_bunny.pest

13 lines
436 B
Plaintext

branch = _{ "{" ~ stmt* ~ expr? ~ "}" }
stmt = _{ let_stmt }
let_stmt = { "let" ~ identifier ~ "=" ~ expr ~ ";" }
expr = { term ~ (binary_op ~ term)* }
term = { val }
val = _{ identifier | literal | "(" ~ expr ~ ")" }
literal = _{ int }
binary_op = { "+" }
int = @{ "-"? ~ ASCII_DIGIT+ }
identifier = @{ ("_" | ASCII_ALPHA) ~ ("_" | ASCII_ALPHANUMERIC)* }
WHITESPACE = _{ " " | "\t" | NEWLINE }
COMMENT = _{ "//" ~ (!NEWLINE ~ ANY)* }