-
Notifications
You must be signed in to change notification settings - Fork 52
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
Packing Declaration Parsing #219
Conversation
aeneas/src/vst/Parser.v3
Outdated
p.error("size expected"); | ||
return 0; | ||
} | ||
else return u8.!(V3.unboxI32(sizeLiteral.val)); |
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.
I think we want to keep this as a literal, so that it can be checked in the Verifier that it's a reasonable size.
aeneas/src/vst/Vst.v3
Outdated
case Other(hint: string); | ||
} | ||
|
||
type VstPacking { | ||
type VstPackingExpr { | ||
case Bits(rep: string); |
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.
Should we make a variant here for the bits and store an array of them? E.g.
type PackingBit {
case Literal(val: u1);
case Wildcard;
case Char(ch: byte);
}
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.
Logic looks good, just needs more tests and a bump of the version number.
@@ -0,0 +1,2 @@ | |||
//@parse |
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.
Can you add some negative parsing tests as well? Also, some simpler cases with only one field, some parts are missing, etc?
aeneas/src/vst/VstPrinter.v3
Outdated
def printPacking(p: VstPacking) { | ||
def printPackingBits(bits: Array<PackingBit>) { | ||
Terminal.put("0b"); | ||
for (bit in bits) { |
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.
Maybe add a _
every four or eight bits?
Introduces
VstPackingDecl
andVstPackingExpr
, allowing for nested packing expressions and packing literals.