-
Notifications
You must be signed in to change notification settings - Fork 0
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
How to represent recursive types #170
Comments
I think a symbol table is the way to go; we anyway want to say "this is that named struct". |
("Anyway" because, for example, if we see the same struct declared twice, we should export it only once, where "the same" means "has the same tag"). |
The symbol table approach is not unambiguous, what about anonymous records (see also #173) struct foo {
struct {
int a;
int b;
} inner;
}; How to represent data Foo_inner = Foo_inner { a :: CInt, b :: CInt } (and put it into a symbol table with some unique name, as we'd probably rather traverse symbol table to generate data-types?) or should we have some anonymous representation (say |
I think we probably don't want the complexity of true anonymous records ( |
FWIW, apparently struct foo {
struct bar {
int a;
int b;
} inner;
};
int main () {
struct bar x = { 1, 2 };
return x.a;
} is valid C (at least |
As I said, it makes sense to add all types to the symbol table. So one could traverse symbol table to translate types. |
Fair enough. |
Consider
our current data types we could represent that as:
with
???
tying back.Infinite data is a bit tricky (e.g.
tree-diff
derived instances won't work out of a box), but they feel nice.There are various alternatives:
The text was updated successfully, but these errors were encountered: