Waddle_Language/grammar/core/literals.bnf

36 lines
1.1 KiB
BNF
Raw Normal View History

<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_content>* <double_quote>
<single_quote_string> ::= <single_quote> <single_quote_content>* <single_quote>
<double_quote_content> ::= <double_quote_character> <double_quote_content>
<single_quote_content> ::= <single_quote_character> <single_quote_content>
<double_quote> ::= "\""
<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> ::= <literal> ("," <literal>)*