mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-02 13:53:07 +00:00
Merge pull request #720 from mir-protocol/stack-manipulation-block-fix
Stack manipulation block change
This commit is contained in:
commit
b933e43cf1
@ -563,13 +563,13 @@ mod tests {
|
||||
let kernel = parse_and_assemble(&["%stack (a, b, c) -> (b)"]);
|
||||
assert_eq!(kernel.code, vec![pop, swap1, pop]);
|
||||
|
||||
let kernel = parse_and_assemble(&["%stack (a, (b: 3), c) -> (c)"]);
|
||||
let kernel = parse_and_assemble(&["%stack (a, b: 3, c) -> (c)"]);
|
||||
assert_eq!(kernel.code, vec![pop, pop, pop, pop]);
|
||||
|
||||
let kernel = parse_and_assemble(&["%stack ((a: 2), (b: 2)) -> (b, a)"]);
|
||||
let kernel = parse_and_assemble(&["%stack (a: 2, b: 2) -> (b, a)"]);
|
||||
assert_eq!(kernel.code, vec![swap1, swap3, swap1, swap2]);
|
||||
|
||||
let kernel1 = parse_and_assemble(&["%stack ((a: 3), (b: 3), c) -> (c, b, a)"]);
|
||||
let kernel1 = parse_and_assemble(&["%stack (a: 3, b: 3, c) -> (c, b, a)"]);
|
||||
let kernel2 =
|
||||
parse_and_assemble(&["%stack (a, b, c, d, e, f, g) -> (g, d, e, f, a, b, c)"]);
|
||||
assert_eq!(kernel1.code, kernel2.code);
|
||||
|
||||
@ -23,8 +23,8 @@ paramlist = { "(" ~ identifier ~ ("," ~ identifier)* ~ ")" }
|
||||
macro_arglist = !{ "(" ~ push_target ~ ("," ~ push_target)* ~ ")" }
|
||||
stack = { ^"%stack" ~ stack_placeholders ~ "->" ~ stack_replacements }
|
||||
stack_placeholders = { "(" ~ stack_placeholder ~ ("," ~ stack_placeholder)* ~ ")" }
|
||||
stack_placeholder = { identifier | stack_block }
|
||||
stack_block = { "(" ~ identifier ~ ":" ~ literal_decimal ~ ")" }
|
||||
stack_placeholder = { stack_block | identifier }
|
||||
stack_block = { identifier ~ ":" ~ literal_decimal }
|
||||
stack_replacements = { "(" ~ stack_replacement ~ ("," ~ stack_replacement)* ~ ")" }
|
||||
stack_replacement = { literal | identifier | constant | macro_label | variable }
|
||||
global_label_decl = ${ ^"GLOBAL " ~ identifier ~ ":" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user