Rules changed

This commit is contained in:
Valk Richard Li 2019-08-13 20:18:14 +08:00 committed by GitHub
parent 8abc674887
commit 5b01409079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 66 additions and 117 deletions

View File

@ -1,127 +1,76 @@
/*
<>
[]
{}0
()
|
*/
<long long int> ::= <long long int>
<double> ::= <double>
<char> ::= <char>
<string> ::= <string>
<array> ::= <array>
<hash> ::= <hash>
<key> ::= <identifier>
<number> ::= <long long int>|<double>
<class_function> ::= <identifier> [<(> { <,> <identifier> } <)>] <{> { <statement> <;> } <}>
<initial_value> ::= <number>|<char>|<string>
<array_initial_value> ::= <[> { <,> <number>|<char>|<string>|<array>|<hash> } <]>
<hash_initial_value> ::= <{> { <string_as_name> <:> <number>|<char>|<string>|<array>|<hash> } <}>
<class_initial_value> ::= <{> { <string_as_name> <:> <number>|<char>|<string>|<array>|<hash>|<class_function> } <}>
<definition_var> ::= <var> <identifier> <=> <initial_value>|<array_initial_value>|<hash_initial_value> <;>
<definition_class> ::= <var> <identifier> <=> <class_initial_value> <;>
<change_var> ::= <identifier> <=> <initial_value>|<array_initial_value>|<hash_initial_value> <;>
<not_global_var> ::= <identifier> <=> <initial_value>|<array_initial_value>|<hash_initial_value> <;>
<change_array> ::= <array> <[> <long long int> <]> <=> <initial_value>|<array_initial_value>|<hash_initial_value> <;>
<change_hash> ::= <hash> <[> <key> <]> <=> <initial_value>|<array_initial_value>|<hash_initial_value> <;>
<append> ::= <(><array> { <,> <number>|<char>|<string>|<array>|<hash> } <)> <;>
<setsize> ::= <(> <array> <,> <long long int> <)> <;>
<subvec> ::= <(> <array> <,> <long long int> <,> <long long int> <)> <;>
<pop> ::= <(> <array> <)> <;>
<sort> ::= <(> <array> <,> <func> <(> <identifier> <,> <identifier> <)> (<identifier> <-> <identifier>)|(<cmp> <(> <identifier> <,> <identifier> <)>) <)> <;>
<contains> ::= <(> <hash> <,> <key> <)> <;>
<delete> ::= <(> <hash> <,> <key> <)> <;>
<keys> ::= <(> <hash> <)> <;>
<choose> ::= [ <if> ] <(> <condition> <)> (<statement> <;>)|(<{> { <statement> <;> } <}>)
{ (<else> <if>)|<elsif> }|[ <else> ] <(> <condition> <)> (<statement> <;>)|(<{> { <statement> <;> } <}>)
<loop> ::= <for> <(> <var> <identifier> <=> <number> <;> <condition> <;> <identifier> <=> <identifier> <+> <number> <)>
<{>
{ <statement> <;> }
<}>
<loop> ::= <while> <(> <condition> <)>
<{>
{ <statement> <;> }
<}>
<loop> ::= <foreach>|<forindex> <(> <identifier> <,> <array> <)>
<{>
{ <statement> <;> }
<}>
<function_definition> ::= <var> <identifier> <func> [<(> { <identifier> } <)>]
<{>
{ <statement> <;> }
<}>
<function_use> ::= <identifier> <(> { ({<,> <number>|<char>|<string>|<array>|<hash>})|({<,> <identifier> <:> <number>|<char>|<string>|<array>|<hash>}) } <)>
<function_reload> ::= <var> <identifier> <func> [<(> { <identifier> } <)>]
<{>
{ <if> <(> <typeof> <(> <identifier> <)> <==> <typename_string> <)> ([<{> {<statement> <;>} <}>])|(<statement> <;>) }
<die> <(> <string> <)> <;>
<}>
<function_dynamic_spawn> ::= <var> <identifier> <func> [<(> { <identifier> } <)>]
<{>
{ <statement> <;> }
<return> <func> [<(> {<,> <identifier>} <)>]
<{>
{ <statement> <;> }
<}>
<}>
<array_print> ::= <array> <[> <number> <]>|[ <.> <key>|<array_print> ]
<hash_print> ::= <hash> <.> <key>|<array_print>
<print> ::= <(> { <,> <identifier>|<string>|<array_print>|<hash_print> } <)> <;>
<error_occur> ::= <die> <(> <string> <)> <;>
<multiple_declare> ::= <(> <var> { <,> <identifier> [<[> <number>|<string> <]>] } <)> <=> <(> { <number>|<char>|<string>|<array>|<hash> } <)> <;>
<multiple_declare> ::= <var> <(> { <,> <identifier> [<[> <number>|<string> <]>] } <)> <=> <(> { <number>|<char>|<string>|<array>|<hash> } <)> <;>
<swap_multiple_var> ::= <(> { <,> <identifier> [<[> <number>|<string> <]>] } <)> <=> <(> { <,> <identifier> [<[> <number>|<string> <]>] } <)> <;>
<var_from_array> ::= <var> <(> { <,> <identifier> [<[> <number>|<string> <]>] } <)> <=> <array> <;>
<sub_array> ::= <var> <identifier> <=> <identifier> <[> { <,> <number> }|(<number> <:> [ <number> ])|<number> <]> <;>
<language type> nasal--
<long long int> ::= <long long int>
<double> ::= <double>
<string> ::= <string>
<array> ::= <array>
<hash> ::= <hash>
<number> ::= <long long int>|<double>
<use_void_function> ::= <identifier> <(> {<identifier>} <)> <;>
<use_return_function> ::= <identifier> <(> {<identifier>} <)>
<definition> ::= <var> <identifier> <=> <number>|<string>|<array>|<hash>|<identifier>|<use_return_function> <;>
<assignment> ::= <identifier> <=> <number>|<string>|<array>|<hash>|<identifier>|<use_function> <;>
<function> ::= <var> <identifier> <=> <func> <(> {<identifier>} <)> <{> {<statement> <;>} <}>
<loop> ::= <for> <(> <var> <identifier> <=> <number> <;> <condition> <;> <identifier> <=> <identifier> <+> <number> <)>
<{>
{ <statement> <;> }
<}>
<loop> ::= <while> <(> <condition> <)>
<{>
{ <statement> <;> }
<}>
<choose> ::= [ <if> ] <(> <condition> <)> (<statement> <;>)|(<{> { <statement> <;> } <}>)
{ (<else> <if>)|<elsif> }|[ <else> ] <(> <condition> <)> (<statement> <;>)|(<{> { <statement> <;> } <}>)
//basic elements
<identifier> ::= IDENTIFIER
<number> ::= NUMBER
<string> ::= STRING
<array_search> ::= <identifier> <[> <number> <]>
<array_member> ::= (<number>|<string>|<array>|<hash>|<identifier>|<use_function>|<array_search>|<hash_search> <,>)|(<number>|<string>|<array>|<hash>|<identifier>|<use_function>|<array_search>|<hash_search>)
<array> ::= <[> <array_member> <]>
<hash_search> ::= <identifier> <[> <string> <]>
<hash_member> ::= (<identifier> <:> <number>|<string>|<array>|<hash>|<function>|<use_function>|<array_search>|<hash_search> <,>)|(<identifier> <:> <number>|<string>|<array>|<hash>|<function>|<use_function>|<array_search>|<hash_search>)
<hash> ::= <{> <hash_member> <}>
<parameter> ::= (<identifier> <,>)|<identifier>
<function> ::= <func> <(> <parameter> <)> <{> <statement> <}>
<use_function> ::= <identifier> <(> <parameter> <)>
<statement> ::= <definition>|<assignment>|<loop>|<ifelse>|<use_function>|<return> <;>
//scalar
<use_identifier> ::= <identifier>|<array_search>|<hash_search>
<scalar> ::= <number>|<string>|<array>|<hash>|<use_identifier>|<use_function>
<scalars> ::= <scalar> <,> <scalar>
<scalars> ::= <scalars> <,> <scalar>
<definition> ::= <var> <identifier> <=> <number>|<string>|<array>|<hash>|<identifier>|<function>|<use_function>|<array_search>|<hash_search> <;>
<assignment> ::= <identifier> <=> <number>|<string>|<array>|<hash>|<identifier>|<function>|<use_function>|<array_search>|<hash_search> <;>
//array
<array_search> ::= <use_identifier> <[> <number> <]>
<array> ::= <[> <scalar>|<scalars> <]>
//hash
<hash_search> ::= <use_identifier> <[> <string> <]>
<hash_member> ::= <identifier> <:> <scalar>
<hash_members> ::= <hash_member> <,> <hash_member>
<hash_members> ::= <hash_members> <,> <hash_member>
<hash> ::= <{> <hash_member>|<hash_members> <}>
//function
<parameter> ::= <scalar>
<parameters> ::= <scalars>
<function> ::= <func> <(> <parameter>|<parameters> <)> <{> <statement>|<statements> <}>
<use_function> ::= <use_identifier> <(> <parameter>|<parameters> <)>
//definition & assignment
<definition> ::= <var> <identifier> <=> <scalar>|<function> <;>
<assignment> ::= <identifier> <=> <scalar> <;>
//loop
<loop_condition> ::= <statement>|<statements> <;> <condition>|<conditions> <;> <statement>|<statements>
<loop> ::= <for> <(> <loop_condition> <)> <statement>|<{> <statement>|<statements> <}>
<loop> ::= <while> <(> <condition>|<conditions> <)> <statement>|<{> <statement>|<statements> <}>
//if else
<condition_link_operator> ::= <and>|<or>|<!>
<cmp_operator> ::= <==>|<>>|<<>|<<=>|<>=>|<!=>|<condition_link_operator>
<condition> ::= <scalar>
<condition> ::= <scalar> <cmp_operator> <scalar>
<conditions> ::= <(> <condition> <)> <condition_link_operator> <(> <condition> <)>
<conditions> ::= <(> <conditions> <)> <condition_link_operator> <(> <condition> <)>
<conditions> ::= <(> <condition> <)> <condition_link_operator> <(> <conditions> <)>
<conditions> ::= <conditions> <condition_link_operator> <(> <condition> <)>
<conditions> ::= <conditions> <condition_link_operator> <(> <conditions> <)>
//(e==1) && (e==2)
//((e==1) && (e==2)) && (e==3)
//(e==1) && ((e==2) && (e==3))
//(e==1) && (e==2) && (e==3) && ((e==4) && (e==5))
<_if> ::= <if> <(> <condition>|<conditions> <)> <statement>
<_if> ::= <if> <(> <condition>|<conditions> <)> <{> <statement>|<statements> <}>
<_else> ::= <else> <statement>
<_else> ::= <else> <{> <statement>|<statements> <}>
<else_if> ::= <else> <if> <(> <condition>|<conditions> <)> <statement>
<else_if> ::= <else> <if> <(> <condition>|<conditions> <)> <{> <statement>|<statements> <}>
<else_ifs> ::= <else_if> <else_if>
<else_ifs> ::= <else_ifs> <else_if>
<choose> ::= <_if>
<choose> ::= <_if> <_else>
<choose> ::= <_if> <else_if>
<choose> ::= <_if> <else_ifs>
<choose> ::= <_if> <else_if> <_else>
<choose> ::= <_if> <else_ifs> <_else>
//statement
<func_return> ::= <return> <scalar>
<statement> ::= <definition>|<assignment>|<loop>|<choose>|<use_function>|<func_return> <;>
<statements> ::= <statement> <statement>
<statements> ::= <statements> <statement>