-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add label in macro ite, add case in linker, add example test fo… #1343
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
Conversation
DavePearce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the change looks good to me. I think we ended up in the right place for what you wanted. You just need to address the syntax error issue, and fix the linting.
pkg/asm/assembler/parser.go
Outdated
| rhs = e.Constant | ||
| label = e.Label | ||
| case *expr.RegAccess: | ||
| panic(fmt.Sprintf("ternary operator does not support register on the rhs")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, don't do a panic. You need to return a proper SyntaxError so that we get a useful error message which highlights where the problem is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted 👌 let me know if it's ok to go backwards to point to the right token or if it's better to print the error on the next token with p.lookahead()
…r ternary operator using a const
526fd2c to
968ae5c
Compare
DavePearce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…r ternary operator using a const
Addresses issue #1284 with some limitations :
Use this feature in TRM module - go-corset side
Note
Adds label-capable ternary (
IfThenElse) parsing and linker resolution (also forIfGoto), and wires an example test plus TRM module usage.parseAtomicExpr; capture constant labels and reject register RHS.macro.IfThenElsewithLabelfor RHS constants.macro.IfGotoandmacro.IfThenElseviagetLabelValue, settingConstant/Right.macro.IfThenElseto includeLabelfield.testdata/asm/util/ternary.zkasmand.acceptswith a simple const-based ternary; newTest_AsmUtil_Ternary(excludesKOALABEAR_16).P256_VERIFY_ADDRESSand use it in ternary instead of literal0x100.Written by Cursor Bugbot for commit bec466c. This will update automatically on new commits. Configure here.