Skip to content

add some doc#114

Open
KimayaBedarkar wants to merge 10 commits into
mainfrom
kimaya/doc
Open

add some doc#114
KimayaBedarkar wants to merge 10 commits into
mainfrom
kimaya/doc

Conversation

@KimayaBedarkar

Copy link
Copy Markdown
Collaborator

No description provided.

@KimayaBedarkar KimayaBedarkar marked this pull request as draft June 3, 2026 23:31
Comment thread README.md Outdated
Comment thread doc/structs.md Outdated
@@ -0,0 +1,16 @@
This doc explains how structs are modelled in pal. Whenever you define a struct `foo`, PAL generates a file `Struct_foo.fst`. This file contains the following:

1. `noeq type struct_foo`: This is the F* record that is the lightweight representation of the struct.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "lightweight"? Maybe a running example through the file would help too!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I am hesitant to use the word "refinement" since it is very overloaded in this context

Comment thread doc/structs.md
This doc explains how structs are modelled in pal. Whenever you define a struct `foo`, PAL generates a file `Struct_foo.fst`. This file contains the following:

1. `noeq type struct_foo`: This is the F* record that is the lightweight representation of the struct.
2. `noeq type struct_foo__spec`: A collection of all the data that pointers in the struct point to. Marked `[@@erasable]` (ghost-only). If the struct has no pointer fields, this type — together with its `pred_unfold`/`pred_fold` ghost fns — is omitted and `struct_foo__pred` collapses to `emp`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the struct has no pointer fields, this type — together with its pred_unfold/pred_fold ghost fns — is omitted and struct_foo__pred collapses to emp.

Is this true? I thought that for a struct like struct foo { int x; int y; } the __spec type would be something like type foo__spec = { x : Int32.t; y : Int32.t }. I.e., it still exists even if there are no pointers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. I double checked.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok! I'm probably just confused. Perhaps a running example of a struct with fields of type int/int*/int** would help.

Comment thread doc/pal_surface_syntax.md
## See also

- `structs.md` / `unions.md` — what gets generated per struct / union.
- `arrays.md` — the array representation, points-to flavors, and the `_array` / `_arrayptr` distinction.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing arrays.md and unions.md?

@KimayaBedarkar KimayaBedarkar marked this pull request as ready for review June 9, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants