Skip to content
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

generate WIT syntax from WIT JSON #1

Merged
merged 40 commits into from
Oct 2, 2023
Merged

generate WIT syntax from WIT JSON #1

merged 40 commits into from
Oct 2, 2023

Conversation

ydnar
Copy link
Collaborator

@ydnar ydnar commented Sep 25, 2023

The command: go run ./cmd/wit-bindgen-go wit ./testdata/wasi/clocks.wit.json

Generates:

package wasi:poll;

interface poll {
    type pollable = u32;
    drop-pollable: func(this: pollable);
    poll-oneoff: func(in: list<pollable>) -> list<bool>;
}

world example-world {
    import poll;
}


package wasi:clocks;

interface monotonic-clock {
    type instant = u64;
    use wasi:poll/poll.{pollable};
    now: func() -> instant;
    resolution: func() -> instant;
    subscribe: func(when: instant, absolute: bool) -> pollable;
}

interface timezone {
    use wall-clock.{datetime};
    record timezone-display {
        utc-offset: s32,
        name: string,
        in-daylight-saving-time: bool
    };
    display: func(when: datetime) -> timezone-display;
    utc-offset: func(when: datetime) -> s32;
}

interface wall-clock {
    record datetime {
        seconds: u64,
        nanoseconds: u32
    };
    now: func() -> datetime;
    resolution: func() -> datetime;
}

world imports {
    import wasi:poll/poll;
    import monotonic-clock;
    import wall-clock;
    import timezone;
}

TODO

@ydnar ydnar self-assigned this Sep 25, 2023
@ydnar ydnar merged commit ab498a6 into main Oct 2, 2023
@ydnar ydnar deleted the wit-syntax branch October 2, 2023 23:44
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.

1 participant