Skip to content

Commit

Permalink
Merge pull request #46 from 0xPolygonHermez/fix-jmp-static
Browse files Browse the repository at this point in the history
fix and update version
  • Loading branch information
zkronos73 authored Dec 12, 2022
2 parents a624bd3 + b0e3dca commit bf6ffed
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 41 deletions.
45 changes: 25 additions & 20 deletions build/zkasm_parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xpolygonhermez/zkasmcom",
"version": "0.0.18",
"version": "0.0.19",
"bin": {
"zkasm": "src/zkasm.js"
},
Expand Down
40 changes: 20 additions & 20 deletions src/zkasm_parser.jison
Original file line number Diff line number Diff line change
Expand Up @@ -538,87 +538,87 @@ op
}
| JMP '(' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3 }
}
| jmpCond '(' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3, useElseAddr: 1, elseAddr: 'next' }
}
| jmpCond '(' IDENTIFIER ',' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3, elseAddr: $5 }
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: $3, useElseAddr: 1, elseAddr: $5 }
}
| jmpNotCond '(' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: 'next', elseAddr: $3 }
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: 'next', useElseAddr: 1, elseAddr: $3 }
}
| jmpNotCond '(' IDENTIFIER ',' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: 'next', elseAddr: $3 }
$$ = { [$1]: 1, useJmpAddr: 1, jmpAddr: 'next', useElseAddr: 1, elseAddr: $3 }
}
| JMP '(' RR ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0, elseAddr: 0 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0 }
}
| JMP '(' E ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0, elseAddr: 0 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0 }
}
| JMP '(' REFERENCE '+' RR ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3, elseAddr: 0 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3 }
}
| JMP '(' REFERENCE '+' E ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3, elseAddr: 0 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3 }
}
| jmpCond '(' RR ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0, useElseAddr: 1, elseAddr: 'next' }
}
| jmpCond '(' E ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0, useElseAddr: 1, elseAddr: 'next' }
}
| jmpCond '(' REFERENCE '+' RR ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3, useElseAddr: 1, elseAddr: 'next' }
}
| jmpCond '(' REFERENCE '+' E ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3, elseAddr: 'next' }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3, useElseAddr: 1, elseAddr: 'next' }
}
| jmpCond '(' RR ',' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0, elseAddr: $5 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: 0, useElseAddr: 1, elseAddr: $5 }
}
| jmpCond '(' E ',' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0, elseAddr: $5 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: 0, useElseAddr: 1, elseAddr: $5 }
}
| jmpCond '(' REFERENCE '+' RR ',' IDENTIFIER ')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3, elseAddr: $7 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 0, indRR: 1, offset: $3, useElseAddr: 1, elseAddr: $7 }
}
| jmpCond '(' REFERENCE '+' E ',' IDENTIFIER')'
{
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3, elseAddr: $7 }
$$ = { [$1]: 1, useJmpAddr: 0, ind: 1, indRR: 0, offset: $3, useElseAddr: 1, elseAddr: $7 }
}
| CALL '(' IDENTIFIER ')'
{
$$ = {JMP: 0, JMPC: 0, JMPN: 0, useJmpAddr:1, jmpAddr: $3, call: 1}
}
| CALL '(' REFERENCE '+' RR ')'
{
$$ = {JMP: 0, JMPC: 0, JMPN: 0, offset: $3, ind: 0, indRR: 1, call: 1}
$$ = {JMP: 0, JMPC: 0, JMPN: 0, offset: $3, ind: 0, indRR: 1, return: 0, call: 1}
}
| CALL '(' REFERENCE '+' E ')'
{
$$ = {JMP: 0, JMPC: 0, JMPN: 0, offset: $3, ind: 1, indRR: 0, call: 1}
$$ = {JMP: 0, JMPC: 0, JMPN: 0, offset: $3, ind: 1, indRR: 0, return: 0, call: 1}
}
| RETURN
{
$$ = {JMP: 0, JMPC: 0, JMPN: 0, ind: 0, indRR: 0, return: 1}
$$ = {JMP: 0, JMPC: 0, JMPN: 0, call: 0, return: 1}
}
| ASSERT
{
Expand Down

0 comments on commit bf6ffed

Please sign in to comment.