From 099e12b5f3fd5e923481ceb64a4b1c362947eed0 Mon Sep 17 00:00:00 2001 From: jaeho Date: Mon, 25 Jul 2022 13:04:28 +0900 Subject: [PATCH] Add syntax.bnf --- syntax.bnf | 574 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 574 insertions(+) create mode 100644 syntax.bnf diff --git a/syntax.bnf b/syntax.bnf new file mode 100644 index 00000000..7ffe1ece --- /dev/null +++ b/syntax.bnf @@ -0,0 +1,574 @@ + ::= + | + | + + ::= + | + | + + ::= + | let : + | + | + | + | + | + | include + | + | + | + | + + ::= + | + | let [rec] {and } + | + | + | + | + | include + | + | + | + | + | + + (* Any String *) + + ::= + | "A" ... "Z" + | "a" ... "z" + + ::= + | ("a"..."z"|"_") {(|"0" ... "9"| "_" | "'" )} + + ::= + | ("A"..."Z"|"_") {(|"0" ... "9"| "_" | "'" )} + + ::= + | + | + + ::= + | ";" + | "\n" + | "\r" + + ::= + | + | = + | : + +TODO : Maybe wrong + ::= +| '(''{' (.|..) '}'')' [:] +| '(''{' ... '}'')' [:] +| '(''{' {} '}'')' [:] +| '(''{' {} '}'')' [:] +| '('')'[:] + + ::= + | = [:> ] + | : type {} . = + | : = [:> ] + + ::= + | + + ::= + | {.} + + ::= + | + + ::= + | [.] + + ::= + | + | [.] + + ::= + | + | + | + + ::= + | [:] => + + ::= + | {'('')'} + | {'('[:] {,[:]}')'} + + ::= + | + | + | + + ::= + | => + | + + ::= + | + | '{''}' + | '(' [: ModuleType]')' + | unpack '(' [:{} ]')' + | + + ::= + | + | '('')' + | '{''}' + | module type of + | + + ::= + | '(' ')' + | '(' {,}')' + + ::= + | : + | + | _ : + | '('')' + | + + ::= + | '<''>' + | '<'{,} '>' + + ::= + | [(+|-)] ' + | [(+|-)] _ + + ::= + | + | ' {'} . + | ' => + +TODO : Alias([as ']) revise + ::= + | [as '] + | + + ::= + | + | [=> ] + + ::= + | ~ : [= ?] => + | => + + ::= + | ' + | _ + | '(' ')' + | '(' {, }')' + | + | + | module '(' ')' + | + | + + ::= + | '[''>''['']'{'|'}]' + | '[''<'['|'] {'|'}']' + | '['{'|'}']' + + ::= + | ['('TypeExpression')'] + | '|' + | + + ::= + | ['('TypeExpression')'] + | + | + + ::= + | ['('[&]TypeExpression { & TypeExpression}')'] + | + | + + ::= + | ['>' {}] + + ::= + | + +TODO : This IntegerLiteral has no suffix + + | # + | # + + ::= + | '('')' + | '(' {,}')' + + ::= + | + | ~ : [= ?] + | + + ::= + | ['<''>'] + + ::= + | (* Empty *) + | {,} + + ::= + | + | with {and } + + ::= + | '{'[(.|..)] '}' + | '{'[(.|..)] {}'}' + + ::= + | : + | ... + | + + ::= + | open[!] + + ::= + | type [(rec|nonrec)] {and } + + ::= + | [] [= ] {} + + ::= + | + + ::= + | [private] + | [private] + | [private] + | [private] [= ] + + ::= + | [as '] + | + + ::= + | [private] [|] + | [private] + | .. + + ::= + | ['|'] {'|'} + + ::= + | + | + + ::= + | '{' '}' + | '{' {,} '}' + + ::= + | [mutable] [?][: + +TODO : Maybe wrong + ::= + | '{'[(.|..)] '}'[as '] + | '{'[(.|..)] {}'}' [as '] + | '{'...'}' + | '{'{}'}' + + ::= + | type = + + ::= + | type [(rec|nonrec)] += [private] ['|'] {'|'} + + ::= + | module + | module + | module + + ::= + | : + | = + + ::= + | rec : {and : } + + ::= + | type [= ] + + + | { } + | ? : + + ::= + | assert + | lazy + | + | + | + | + | + | + | + | + + ::= + | + | - + | -. + | + + | +. + | ! + + ::= + | try catch '{''}' + +TODO : Currently, IfLetExpression is not supported. + ::= + | if + + ::= + | [else ] + | [else ] + + ::= + | + + ::= + | '{' '}' + + ::= + | '{' '}' + + ::= + | for + | for '('')' + | for '('[,][as '] ')' + + ::= + | in (to|downto) '{''}' + + ::= + | while '{''}' + + ::= + | switch '{''}' + + ::= + | [:] => + + ::= + | {} + + ::= + | '|' (when|if) => + +TODO : Maybe wrong + ::= + | [[]] + | [:> ] + +TODO : Maybe wrong + ::= + | + | module + | module { }{? : } + | + | + | let [rec] {and } + + ::= + | "#=" + | ":=" + | "||" + | "&&" + | "=" + | "==" + | "===" + | "<" + | ">" + | "!=" + | "!=" + | "!==" + | "<=" + | ">=" + | "|>" + | "+" + | "+." + | "-." + | "-." + | "++" + | "*" + | "*." + | "/" + | "/." + | "**" + | "->" + | "." + + ::= + | (* Empty *) + | . [= ] + | + | + | + | + + ::= + | true + | false + | + | + | + | + | '('')' + | '(' [,]')' + | list + | module + | + | + | + | + + ::= + | + | + | + | + + ::= + | '['']'[= ] + | '['']'[= ] + + ::= + | '('')' + | '('{,}')' + +TODO : Scanner.scanTemplateLiteralToken + ::= ??? + + ::= + | external : = + + ::= + | exception + + ::= + | module type + | module + | module [rec] [:] = + + ::= + | = + + ::= + | '(' : [{} ]')' + + ::= + | '['']' + | '[' : {, : }']' + +TODO : Missing parts + ::= + | '{'... '}' + | '{' : {, : }'}' + | '{'? '}' + +TODO + ::= ??? + +TODO + ::= ??? + +TODO + ::= ??? + + ::= + | @ + | @ '('')' + + ::= + | @@ + | @@ '('')' + + ::= + | % + | % '('')' + + ::= + | %% + | %% '('')' + + ::= + | + | . + + ::= + | ['(':')'] + | ['('? [(when|if) ]')'] + | ['('')'] + +TODO : Revise "alias" and "or" + ::= + | "true" + | "false" + | [ .. ] + | + | '('')' + | '(' {,}')' + | + | + | _ + | [] + | [] + | + | #... + | + | exception + | lazy + | list + | module + | + | + | [as '] + | ['|'] + +TODO : Fill it + ::= ??? + + ::= + | [: ] + + ::= + | {,} + + ::= + | '['']' + | '['{,}']' + + ::= + | '{''}' + | '{'{,}'}' + + ::= + | ... + | [?] + | _ + + ::= + | [:[?]] + + ::= + | '('')' + | '('{,}')' + + ::= + | '{'[...] {,}'}' + + ::= + | '('[[:{} ]]')'