Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aleo ins] Update grammar based on audit. #62

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions aleo.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ value-type = plaintext-type %s".constant"
/ locator %s".record"

finalize-type = plaintext-type %s".public"
/ identifier %s".record"
/ locator %s".record"

entry-type = plaintext-type ( %s".constant" / %s".public" / %s".private" )

Expand Down Expand Up @@ -331,10 +329,13 @@ assert-op = %s"assert.eq" / %s"assert.neq"
commit-op = %s"commit.bhp" ( "256" / "512" / "768" / "1024" )
/ %s"commit.ped" ( "64" / "128" )

hash-op = %s"hash.bhp" ( "256" / "512" / "768" / "1024" )
/ %s"hash.ped" ( "64" / "128" )
/ %s"hash.psd" ( "2" / "4" / "8" )
/ %s"hash_many.psd" ( "2" / "4" / "8" )
hash1-op = %s"hash.bhp" ( "256" / "512" / "768" / "1024" )
/ %s"hash.ped" ( "64" / "128" )
/ %s"hash.psd" ( "2" / "4" / "8" )

hash2-op = %s"hash_many.psd" ( "2" / "4" / "8" )

signverify-op = %s"sign.verify"

cast-op = %s"cast"

Expand All @@ -356,15 +357,24 @@ commit = commit-op ws operand ws operand
ws %s"into" ws register
ws %s"as" ws ( address-type / field-type / group-type )

hash = hash-op ws operand
ws %s"into" ws register
ws %s"as" ws ( arithmetic-type / address-type )
hash1 = hash1-op ws operand
ws %s"into" ws register
ws %s"as" ws ( arithmetic-type / address-type )

hash2 = hash2-op ws operand ws operand
ws %s"into" ws register
ws %s"as" ws ( arithmetic-type / address-type )

hash = hash1 / hash2

signverify = signverify-op ws operand ws operand ws operand
ws %s"into" ws register

cast = cast-op 1*( ws operand )
ws %s"into" ws register ws %s"as" ws cast-destination

call = %s"call" ws ( locator / identifier ) ws *( ws operand )
ws %s"into" ws 1*( ws register )
ws [ %s"into" ws *( ws register ) ]

instruction = cws
( unary
Expand All @@ -374,6 +384,7 @@ instruction = cws
/ assert
/ commit
/ hash
/ signverify
/ cast
/ call )
ws ";"
Expand Down Expand Up @@ -401,15 +412,15 @@ remove = cws %s"remove"
random = cws %s"rand.chacha"
*2( ws operand )
ws %s"into" ws register
ws %s"as" literal-type ws ";"
ws %s"as" ws literal-type ws ";"

label = identifier

position = cws %s"position" ws label ws ";"

branch-op = %s"branch.eq" / %s"branch.neq"

branch = cws branch-op ws operand ws operand ws label ws ";"
branch = cws branch-op ws operand ws operand ws %s"to" ws label ws ";"

command = contains
/ get
Expand All @@ -426,7 +437,7 @@ finalize-command = cws %s"finalize" *( ws operand ) ws ";"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

closure = cws %s"closure" ws identifier ws ":"
*closure-input
1*closure-input
1*instruction
*closure-output

Expand All @@ -453,14 +464,10 @@ function-output = cws %s"output" ws operand
finalize = cws %s"finalize" ws identifier ws ":"
*finalize-input
1*command
*finalize-output

finalize-input = cws %s"input" ws register
ws %s"as" ws finalize-type ws ";"

finalize-output = cws %s"output" ws operand
ws %s"as" ws finalize-type ws ";"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

program = *import
Expand Down