[ABNF] Add circuits and add associated constants.

This commit is contained in:
Alessandro Coglio 2022-06-23 15:06:39 -07:00
parent abc50d8c3e
commit 35485bea25

View File

@ -78,6 +78,7 @@ end-of-line-comment = "//" *not-line-feed-or-carriage-return
keyword = %s"address"
/ %s"bool"
/ %s"circuit"
/ %s"console"
/ %s"const"
/ %s"constant"
@ -241,11 +242,17 @@ literal = atomic-literal / affine-group-literal
group-literal = product-group-literal / affine-group-literal
primary-expression = identifier
/ literal
primary-expression = literal
/ variable-or-free-constant
/ associated-constant
/ "(" expression ")"
/ free-function-call
/ static-function-call
/ circuit-expression
variable-or-free-constant = identifier
associated-constant = named-type "::" identifier
free-function-call = identifier function-arguments
@ -253,9 +260,19 @@ static-function-call = named-type "::" identifier function-arguments
function-arguments = "(" [ expression *( "," expression ) [ "," ] ] ")"
circuit-expression = identifier "{" [ circuit-component-initializer
*( "," circuit-component-initializer )
[ "," ] ] "}"
circuit-component-initializer = identifier
/ identifier ":" expression
postfix-expression = primary-expression
/ circuit-component-expression
/ operator-call
circuit-component-expression = postfix-expression "." identifier
operator-call = unary-operator-call / binary-operator-call
unary-operator-call = postfix-expression "." identifier "(" ")"
@ -370,7 +387,14 @@ function-parameters = function-parameter *( "," function-parameter ) [ "," ]
function-parameter = [ %s"public" / %s"constant" / %s"const" ]
identifier ":" type
circuit-declaration = %s"circuit" "{" [ circuit-component-declaration
*( "," circuit-component-declaration )
[ "," ] ] "}"
circuit-component-declaration = identifier ":" type
declaration = function-declaration
/ circuit-declaration
file = *declaration