From 3d876025824c83a1aa764d76256071f7c97acd4e Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Fri, 17 Jan 2020 17:29:01 +0800 Subject: [PATCH] add ebnf --- version2.0/parse.ebnf | 121 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 version2.0/parse.ebnf diff --git a/version2.0/parse.ebnf b/version2.0/parse.ebnf new file mode 100644 index 0000000..735c17d --- /dev/null +++ b/version2.0/parse.ebnf @@ -0,0 +1,121 @@ +(* + <> must choose + [] can choose + {} can repeat 0 to infinite time(s) + | or + ::= is defined as +*) + = ; + = ; + = ; + = ; + = ; + = ; + = ; + = ; + = ; + + = '[' { ',' } ']' ; + = '{' {( | ) ':' ','} '}' ; + = + +| +| +| +| +| +| +| +| +| '(' ')' +| { ('[' { ','} ']') | ('[' ':' [] ']') | ('.' ) | ('(' { ','} ')') | ('(' { ':' ','} ')') } +; +0 + = + ['(' ')'] +| ['(' ')'] '{' { ';'} '}' +| '(' { ','} { '=' ','} {} ')' +| '(' { ','} { '=' ','} {} ')' '{' { ';'} '}' +; + + = + +| +| +| +| [('-' | '!')] +; + = { } ; + = { } ; + = {('+' | '-' | '~') } ; + =[('-' | '!')] {[('-' | '!')] } ; + +(* this definition is also used in for loop*) + = + '=' +| '(' {() | () ','} ')' '=' ( | '(' { ','} ')') +| '(' {() | () ','} ')' '=' ( | '(' { ','} ')') +; + = + +; + = + +; + = + '=' +| '(' { ','} ')' '=' ( | '(' { ','} ')') +; + = + +| +| +| +; + = + '(' [] ';' [] ';' ')' [';'] +| '(' [] ';' [] ';' ')' '{' { ';'} '}' +; + = + '(' ')' [';'] +| '(' ')' '{' { ';'} '}' +; +(* in forindex and foreach the scalar and definition cannot be lacked*) + = + '(' ';' ')' [';'] +| '(' ';' ')' '{' { ';'} '}' +; + = + '(' ';' ')' [';'] +| '(' ';' ')' '{' { ';'} '}' +; + + = {} [] +; + = + '(' ')' [';'] +| '(' ')' '{' { ';'} '}' +; + = + '(' ')' [';'] +| '(' ')' '{' { ';'} '}' +| '(' ')' [';'] +| '(' ')' '{' { ';'} '}' +; + = + [';'] +| '{' { ';'} '}' +; + + = ; + = ; + = [] ; + = + +| +| +| +| +| +| +; \ No newline at end of file