This commit is contained in:
Valk Richard Li 2020-01-02 15:23:49 +08:00 committed by GitHub
parent a4eefdc191
commit 98c58c4680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 61 additions and 28 deletions

View File

@ -4,36 +4,69 @@
# | or # | or
# ::= is defined as # ::= is defined as
<number> ::= <token_type_number> <number> ::= <token_number>
<string> ::= <token_type_string> <string> ::= <token_string>
<id> ::= <token_type_identifier> <id> ::= <token_identifier>
<dynamic_id> ::= <token_type_dynamic_id> <dynamic_id> ::= <token_dynamic_id>
<vector> ::= <[> { <scalar> <,> } <]> <scalar> ::=
<hash> ::= <{> { ( <id> ) | ( <string> ) <:> <scalar> <,> } <}>
<function> ::=<func> [ <(> { ( <id> [ <=> <scalar> ] ) | ( <dynamic_id> ) <,> } <)> ] ( <statement> ) | ( <{> { <statement> <;> } <}> ) <calculation_expr> ::=
<calculation> ::= <or_expr> {<and> <or_expr>}
<or_expr> ::=
<unary_expr> {<or> <unary_expr>}
| <unary_expr> {<or> <additive_expr>}
| <additive_expr> {<or> <unary_expr>}
| <additive_expr> {<or> <additive_expr>}
<unary_expr> ::=
<-> <additive_expr>
| <!> <additive_expr>
<additive_expr> ::=
<multive_expr> {<+> <multive_expr>}
| <multive_expr> {<-> <multive_expr>}
| <multive_expr> {<~> <multive_expr>}
<multive_expr> ::=
<scalar> {<*> <scalar>}
| <scalar> {</> <scalar>}
<definition> ::= <loop_expr> ::=
<var> <id> <=> <scalar> <for_loop>
| <var> <(> <id> { <,> <id> } <)> <=> <scalar> | <while_loop>
| <(> <var> <id> { <,> <id> } <) <=> <scalar> | <forindex_loop>
| <foreach_loop>
<for_loop> ::=
<for> <(> [<statement>] <;> [<scalar>] <;> <statement> <)> <statement> [<;>]
| <for> <(> [<statement>] <;> [<scalar>] <;> <statement> <)> <{> {<statement> <;>} <}>
<while_loop> ::=
<while> <(> <scalar> <)> <statement> [<;>]
| <while> <(> <scalar> <) <{> {<statement> <;>} <}>
<forindex_loop> ::=
<forindex> <(> [<statement] <;> [<scalar>] <)> <statement> [<;>]
| <forindex> <(> [<statement] <;> [<scalar>] <) <{> {<statement> <;>} <}>
<foreach_loop> ::=
<foreach> <(> [<statement] <;> [<scalar>] <)> <statement> [<;>]
| <foreach> <(> [<statement] <;> [<scalar>] <) <{> {<statement> <;>} <}>
<assignment> ::= <choose_expr> ::= <choose_expr_if> {<choose_expr_elsif>} [<choose_expr_else>]
<choose_expr_if> ::=
<if-else> ::= <if> <(> <scalar> <)> <statement> [<;>]
<if> <(> <scalar> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) | <if> <(> <scalar> <)> <{> {<statement> <;>} <}>
{ ( <elsif> ) | ( <else> <if> ) } <(> <scalar> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) <choose_expr_elsif> ::=
[<else> ( <statement> ) | ( <{> { <statement> <;> } <}> ) <elsif> <(> <scalar> <)> <statement> [<;>]
<loop> ::= | <elsif> <(> <scalar> <)> <{> {<statement> <;>} <}>
<for> <(> <;> <;> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) | <else> <if> <(> <scalar> <)> <statement> [<;>]
| <foreach> <(> <;> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) | <else> <if> <(> <scalar> <)> <{> {<statement> <;>} <}>
| <forindex> <(> <;> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) <choose_expr_else> ::=
| <while> <(> <scalar> <)> ( <statement> ) | ( <{> { <statement> <;> } <}> ) <else> <statement> [<;>]
| <else> {<statement> <;>} <}>
<continue_expr> ::= <continue>
<break_expr> ::= <break>
<return_expr> ::= <return> [<scalar>]
<statement> ::= <statement> ::=
<definition> <definition>
| <assignment> | <assignment>
| <if-else> | <choose_expr>
| <loop> | <loop_expr>
| <scalar> | <continue_expr>
| <break_expr>
| <return_expr>