Waddle_Language/grammar/core/literals.bnf

41 lines
1.5 KiB
BNF

<literal> ::= <number_literal>
| <string_literal>
| <boolean_literal>
| <null_literal>
| <array_literal>
<number_literal> ::= <integer_literal> | <decimal_literal>
<integer_literal> ::= <digit>+
| "-" <digit>+
<decimal_literal> ::= <digit>+ "." <digit>+
| "-" <digit>+ "." <digit>+
<string_literal> ::= <double_quote_string> | <single_quote_string>
<double_quote_string> ::= <double_quote> <double_quote_character>* <double_quote>
<single_quote_string> ::= <single_quote> <single_quote_character>* <single_quote>
<double_quote_character> ::= <letter> | <digit> | <symbol> | <whitespace>
<single_quote_character> ::= <letter> | <digit> | <symbol> | <whitespace>
<boolean_literal> ::= <true_keyword> | <false_keyword>
<null_literal> ::= <null_keyword>
<array_literal> ::= <array_symbol_open> <literal_list>? <array_symbol_close>
<literal_list> ::= <optional_whitespace> <integer_literal_list> | <decimal_literal_list> | <string_literal_list> | <boolean_literal_list> <optional_whitespace>
<integer_literal_list> ::= <integer_literal> <optional_whitespace> ("," <optional_whitespace> <integer_literal>)*
<decimal_literal_list> ::= <decimal_literal> <optional_whitespace> ("," <optional_whitespace> <decimal_literal>)*
<string_literal_list> ::= <string_literal> <optional_whitespace> ("," <optional_whitespace> <string_literal>)*
<boolean_literal_list> ::= <boolean_literal> <optional_whitespace> ("," <optional_whitespace> <boolean_literal>)*