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.
moon/grammar.ebnf

32 lines
1.4 KiB
EBNF

Assign ::= Identifier ":" Value
Assign_Hidden ::= Variable ":" Value
Identifier ::= PrintChar +
Variable ::= "@" Identifier
Bare_String ::= (GraphicChar | ("\" Char)) +
Quoted_String ::= '"' ([^"\] | "\" Char) * '"'
| "'" ([^'\] | "\" Char) * "'"
10 years ago
Comment ::= '#' GraphicChar +
10 years ago
Integer ::= [+-] ? ([1-9] Digit + | [0])
Hex ::= [+-] ? "0" [xX] (Digit | [a-fA-F]) +
Octal ::= [+-] ? "0" [0-7] +
Float ::= [+-]? Digit+ ("." Digit +)? ([eE] [+-] ? Digit +)?
Complex ::= ((Float | Integer) [+-])? (Float | Integer) "i"
Duration ::= [+-] ? (Digit + ("." Digit +) ("ns" | "us" | "µs" | "ms" | "s" | "m" | "h")) +
Numer ::= Integer | Hex | Octal | Float
Object ::= "{" (Identifier ":" Value) + "}"
List ::= "[" Value + "]"
Value ::= String | Number | Duration | Variable | Object | List
Heredoc ::= "<<" Identifier "\n" (Char | "\n") + "\n" "Identifier (same as opening identifier)" "\n"
Letter ::= "a Unicode letter, category L"
Mark ::= "a Unicode mark, category M"
Digit ::= [0-9]
Symbol ::= "a Unicode symbol character, category S"
Space ::= "a Unicode space character, category Z, excluding \n"
Punct ::= "a Unicode punctuation glyph, category P, excluding those described as terminal characters"
Terminal ::= "[" | "]" | ";" | ":" | "{" | "}" | "\" | "#" | "\n"
PrintChar ::= Letter | Mark | Number | Symbol | Punct
GraphicChar ::= PrintChar | Space
Char ::= GraphicChar | Terminal