Open yav opened 3 months ago
That would be very useful. Though I think CN's pretty-print should always produce output that CN could also parse (i.e. valid CN, not special different C-like syntax), for consistency.
Did this commit close this issue? https://github.com/rems-project/cerberus/commit/a955e58a7fd502b5e1b3641c8ea0f03ebd54116e
Not fully, no.
Ok, can the remaining things be put in a separate issue and this one closed then?
@yav @cp526 can you clarify what's done and what's remaining on this?
I am not 100% sure, but based on the discussion on PR #470, these are some things that need to be done:
&p->x
instead of shift_member(p,s)
and &a[i]
instead of shift_array(a,i)
.
Thanks for clarifying, much appreciated.
Users need to provide a type for MemberShift
for the same reason that OffsetOf
needs one - to look up in the memory model. Similarly with ArrayShift
(size of the C type). Index terms pointers don't have C type information attached. See https://github.com/rems-project/cerberus/issues/349 for further details, though I see some related discussion was present on on #470 already.
- Use a notation that mirrors the input, or at even better C, so instead of member_shift
(e,x), we could just write e->x
I have written specs (in #361) that use member_shift
with the same e
but different T
and x
, so this needs to be a conditional pretty-printing.
The pretty printer for CN terms makes it pretty hard to read the constraints. It might be nice to improve the current one, or just have a different pretty printer that we use explicitly for rendering output intended to be viewed by the user.
Some of the features that would be nice to have:
member_shift<T>(e,x)
, we could just writee->x