wit

    WIT parser and resolver in MoonBit

    wit
    wasm
    component
    Download zip
    Author
    Version
    0.4.0
    License
    Apache-2.0
    Last updated
    6 hours ago
    Downloads
    65K

    #mizchi/wit

    WIT (WebAssembly Interface Types) parser and resolver written in MoonBit.

    #Features

    • Lexer & Parser – Tokenize and parse WIT source into a typed AST
    • Resolver – Resolve parsed WIT into a flat, index-based representation suitable for code generation
    • Path resolver – Load WIT files from deps/ directory layouts produced by wkg
    • Current WIT syntax – Async functions, optional future/stream payloads, error contexts, fixed-length lists, maps, file-local aliases, nested packages, external IDs, and property accessors

    See WIT support and validation limits and 0.4.0 API changes. Verified with MoonBit 0.1.20261104.

    #Install

    moon add mizchi/wit

    #Usage

    #Parse a WIT source string

    let source = "package local:hello;\n\ninterface greet {\n greet: func(name: string) -> string;\n}\n\nworld hello {\n export greet;\n}\n"
    inspect(parse(source))

    #Resolve to a flat model

    let source = "package local:hello;\n\ninterface greet {\n greet: func(name: string) -> string;\n}\n\nworld hello {\n export greet;\n}\n"
    inspect(resolve(source))

    #API

    FunctionDescription
    parse(String) -> Result[WitFile, ParseError]Parse a WIT source string into an AST
    parse_path(String) -> Result[WitFile, ParseError]Parse a WIT file from a file path
    resolve(String) -> Result[Resolve, ParseError]Parse and resolve a WIT source string
    resolve_path(String, world? : String) -> Result[ResolveInput, ParseError]Resolve WIT from a directory path with optional world selection
    tokenize(String) -> Result[Array[Token], ParseError]Tokenize a WIT source string

    #License

    Apache-2.0

    ParseError

    pub suberror ParseError {
    Message(String, Int)
    } derive(Eq,
    Debug
    )

    impl Show for ParseError

    ParseError::equal

    fn ParseError::equal(ParseError, ParseError) -> Bool

    ParseError::not_equal

    fn ParseError::not_equal(x : ParseError, y : ParseError) -> Bool

    ParseError::output

    fn ParseError::output(self : ParseError, logger : &Logger) -> Unit

    ParseError::to_string

    fn ParseError::to_string(self : ParseError) -> String

    Field

    pub struct Field {
    name : String
    ty : TypeExpr
    } derive(Eq,
    Debug
    )

    impl Show for Field

    Field::equal

    fn Field::equal(Field, Field) -> Bool

    Field::not_equal

    fn Field::not_equal(x : Field, y : Field) -> Bool

    Field::output

    fn Field::output(self : Field, logger : &Logger) -> Unit

    Field::to_repr

    Field::to_string

    fn Field::to_string(self : Field) -> String

    Function

    pub struct Function {
    name : String
    kind : FunctionKind
    params : Array[Param]
    result : TypeExpr?
    docs : String?
    external_id : String?
    } derive(Eq,
    Debug
    )

    impl Show for Function

    Function::equal

    fn Function::equal(Function, Function) -> Bool

    Function::not_equal

    fn Function::not_equal(x : Function, y : Function) -> Bool

    Function::output

    fn Function::output(self : Function, logger : &Logger) -> Unit

    Function::to_repr

    Function::to_string

    fn Function::to_string(self : Function) -> String

    FunctionKind

    pub enum FunctionKind {
    Freestanding
    AsyncFreestanding
    Getter
    Setter
    Constructor(String)
    Method(String)
    AsyncMethod(String)
    MethodGetter(String)
    MethodSetter(String)
    Static(String)
    AsyncStatic(String)
    StaticGetter(String)
    StaticSetter(String)
    } derive(Eq,
    Debug
    )

    FunctionKind::equal

    FunctionKind::not_equal

    fn FunctionKind::not_equal(x : FunctionKind, y : FunctionKind) -> Bool

    FunctionKind::output

    fn FunctionKind::output(self : FunctionKind, logger : &Logger) -> Unit

    FunctionKind::to_string

    fn FunctionKind::to_string(self : FunctionKind) -> String

    IncludeDecl

    pub struct IncludeDecl {
    path : UsePath
    renames : Array[IncludeRename]
    } derive(Eq,
    Debug
    )

    impl Show for IncludeDecl

    IncludeDecl::equal

    fn IncludeDecl::equal(IncludeDecl, IncludeDecl) -> Bool

    IncludeDecl::not_equal

    fn IncludeDecl::not_equal(x : IncludeDecl, y : IncludeDecl) -> Bool

    IncludeDecl::output

    fn IncludeDecl::output(self : IncludeDecl, logger : &Logger) -> Unit

    IncludeDecl::to_string

    fn IncludeDecl::to_string(self : IncludeDecl) -> String

    IncludeRename

    pub struct IncludeRename {
    from : String
    to : String
    } derive(Eq,
    Debug
    )

    IncludeRename::equal

    IncludeRename::not_equal

    fn IncludeRename::not_equal(x : IncludeRename, y : IncludeRename) -> Bool

    IncludeRename::output

    fn IncludeRename::output(self : IncludeRename, logger : &Logger) -> Unit

    IncludeRename::to_string

    fn IncludeRename::to_string(self : IncludeRename) -> String

    InlineInterface

    pub struct InlineInterface {
    name : String
    docs : String?
    items : Array[InterfaceItem]
    } derive(Eq,
    Debug
    )

    InlineInterface::equal

    InlineInterface::not_equal

    fn InlineInterface::not_equal(x : InlineInterface, y : InlineInterface) -> Bool

    InlineInterface::output

    fn InlineInterface::output(self : InlineInterface, logger : &Logger) -> Unit

    InlineInterface::to_string

    fn InlineInterface::to_string(self : InlineInterface) -> String

    Interface

    pub struct Interface {
    name : String
    docs : String?
    items : Array[InterfaceItem]
    } derive(Eq,
    Debug
    )

    impl Show for Interface

    Interface::equal

    fn Interface::equal(Interface, Interface) -> Bool

    Interface::not_equal

    fn Interface::not_equal(x : Interface, y : Interface) -> Bool

    Interface::output

    fn Interface::output(self : Interface, logger : &Logger) -> Unit

    Interface::to_string

    fn Interface::to_string(self : Interface) -> String

    InterfaceItem

    pub enum InterfaceItem {
    Use(UseDecl)
    TypeDef(TypeDef)
    Function(Function)
    } derive(Eq,
    Debug
    )

    InterfaceItem::equal

    InterfaceItem::not_equal

    fn InterfaceItem::not_equal(x : InterfaceItem, y : InterfaceItem) -> Bool

    InterfaceItem::output

    fn InterfaceItem::output(self : InterfaceItem, logger : &Logger) -> Unit

    InterfaceItem::to_string

    fn InterfaceItem::to_string(self : InterfaceItem) -> String

    PackageName

    pub struct PackageName {
    ns : String
    name : String
    version : String?
    } derive(Eq,
    Debug
    )

    impl Show for PackageName

    PackageName::equal

    fn PackageName::equal(PackageName, PackageName) -> Bool

    PackageName::not_equal

    fn PackageName::not_equal(x : PackageName, y : PackageName) -> Bool

    PackageName::output

    fn PackageName::output(self : PackageName, logger : &Logger) -> Unit

    PackageName::to_string

    fn PackageName::to_string(self : PackageName) -> String

    Param

    pub struct Param {
    name : String
    ty : TypeExpr
    } derive(Eq,
    Debug
    )

    impl Show for Param

    Param::equal

    fn Param::equal(Param, Param) -> Bool

    Param::not_equal

    fn Param::not_equal(x : Param, y : Param) -> Bool

    Param::output

    fn Param::output(self : Param, logger : &Logger) -> Unit

    Param::to_repr

    Param::to_string

    fn Param::to_string(self : Param) -> String

    RFunction

    pub struct RFunction {
    name : String
    kind : RFunctionKind
    params : Array[(String, RType)]
    result : RType?
    docs : String?
    external_id : String?
    } derive(Eq,
    Debug
    )

    Function definition
    impl Show for RFunction

    RFunction::equal

    fn RFunction::equal(RFunction, RFunction) -> Bool

    RFunction::not_equal

    fn RFunction::not_equal(x : RFunction, y : RFunction) -> Bool

    RFunction::output

    fn RFunction::output(self : RFunction, logger : &Logger) -> Unit

    RFunction::to_json

    RFunction::to_string

    fn RFunction::to_string(self : RFunction) -> String

    RFunctionKind

    pub enum RFunctionKind {
    Freestanding
    AsyncFreestanding
    Getter
    Setter
    Constructor(Int)
    Method(Int)
    AsyncMethod(Int)
    MethodGetter(Int)
    MethodSetter(Int)
    Static(Int)
    AsyncStatic(Int)
    StaticGetter(Int)
    StaticSetter(Int)
    } derive(Eq,
    Debug
    )

    Function kind

    RFunctionKind::equal

    RFunctionKind::not_equal

    fn RFunctionKind::not_equal(x : RFunctionKind, y : RFunctionKind) -> Bool

    RFunctionKind::output

    fn RFunctionKind::output(self : RFunctionKind, logger : &Logger) -> Unit

    RFunctionKind::to_json

    RFunctionKind::to_string

    fn RFunctionKind::to_string(self : RFunctionKind) -> String

    RHandleKind

    pub enum RHandleKind {
    Own(Int)
    Borrow(Int)
    } derive(Eq,
    Debug
    )

    impl Show for RHandleKind

    RHandleKind::equal

    fn RHandleKind::equal(RHandleKind, RHandleKind) -> Bool

    RHandleKind::not_equal

    fn RHandleKind::not_equal(x : RHandleKind, y : RHandleKind) -> Bool

    RHandleKind::output

    fn RHandleKind::output(self : RHandleKind, logger : &Logger) -> Unit

    RHandleKind::to_json

    RHandleKind::to_string

    fn RHandleKind::to_string(self : RHandleKind) -> String

    RInterface

    pub struct RInterface {
    name : String?
    docs : String?
    functions : Map[String, RFunction]
    types : Map[String, Int]
    pkg : Int?
    } derive(Eq,
    Debug
    )

    impl Show for RInterface

    RInterface::equal

    fn RInterface::equal(RInterface, RInterface) -> Bool

    RInterface::not_equal

    fn RInterface::not_equal(x : RInterface, y : RInterface) -> Bool

    RInterface::output

    fn RInterface::output(self : RInterface, logger : &Logger) -> Unit

    RInterface::to_json

    RInterface::to_string

    fn RInterface::to_string(self : RInterface) -> String

    RInterfaceRef

    pub struct RInterfaceRef {
    id : Int
    external_id : String?
    } derive(Eq,
    Debug
    )

    RInterfaceRef::equal

    RInterfaceRef::not_equal

    fn RInterfaceRef::not_equal(x : RInterfaceRef, y : RInterfaceRef) -> Bool

    RInterfaceRef::output

    fn RInterfaceRef::output(self : RInterfaceRef, logger : &Logger) -> Unit

    RInterfaceRef::to_json

    RInterfaceRef::to_string

    fn RInterfaceRef::to_string(self : RInterfaceRef) -> String

    RPackage

    pub struct RPackage {
    name : RPackageName
    interfaces : Map[String, Int]
    worlds : Map[String, Int]
    } derive(Eq,
    Debug
    )

    impl Show for RPackage

    RPackage::equal

    fn RPackage::equal(RPackage, RPackage) -> Bool

    RPackage::not_equal

    fn RPackage::not_equal(x : RPackage, y : RPackage) -> Bool

    RPackage::output

    fn RPackage::output(self : RPackage, logger : &Logger) -> Unit

    RPackage::to_json

    RPackage::to_repr

    RPackage::to_string

    fn RPackage::to_string(self : RPackage) -> String

    RPackageName

    pub struct RPackageName {
    ns : String
    name : String
    version : String?
    } derive(Eq,
    Debug
    )

    RPackageName::equal

    RPackageName::not_equal

    fn RPackageName::not_equal(x : RPackageName, y : RPackageName) -> Bool

    RPackageName::output

    fn RPackageName::output(self : RPackageName, logger : &Logger) -> Unit

    RPackageName::to_json

    RPackageName::to_string

    fn RPackageName::to_string(self : RPackageName) -> String

    RRecordField

    pub struct RRecordField {
    name : String
    field_type : RType
    } derive(Eq,
    Debug
    )

    RRecordField::equal

    RRecordField::not_equal

    fn RRecordField::not_equal(x : RRecordField, y : RRecordField) -> Bool

    RRecordField::output

    fn RRecordField::output(self : RRecordField, logger : &Logger) -> Unit

    RRecordField::to_json

    RRecordField::to_string

    fn RRecordField::to_string(self : RRecordField) -> String

    RType

    pub enum RType {
    Bool
    U8
    U16
    U32
    U64
    S8
    S16
    S32
    S64
    F32
    F64
    Char
    String_
    ErrorContext
    Id(Int)
    } derive(Eq,
    Debug
    )

    Resolve type reference
    impl Show for RType

    RType::equal

    fn RType::equal(RType, RType) -> Bool

    RType::not_equal

    fn RType::not_equal(x : RType, y : RType) -> Bool

    RType::output

    fn RType::output(self : RType, logger : &Logger) -> Unit

    RType::to_json

    RType::to_repr

    RType::to_string

    fn RType::to_string(self : RType) -> String

    RTypeDef

    pub struct RTypeDef {
    name : String?
    kind : RTypeKind
    owner : RTypeOwner
    docs : String?
    external_id : String?
    } derive(Eq,
    Debug
    )

    impl Show for RTypeDef

    RTypeDef::equal

    fn RTypeDef::equal(RTypeDef, RTypeDef) -> Bool

    RTypeDef::not_equal

    fn RTypeDef::not_equal(x : RTypeDef, y : RTypeDef) -> Bool

    RTypeDef::output

    fn RTypeDef::output(self : RTypeDef, logger : &Logger) -> Unit

    RTypeDef::to_json

    RTypeDef::to_repr

    RTypeDef::to_string

    fn RTypeDef::to_string(self : RTypeDef) -> String

    RTypeKind

    pub enum RTypeKind {
    Record(Array[RRecordField])
    Variant(Array[RVariantCase])
    List(RType)
    FixedLengthList(RType, UInt)
    Map(RType, RType)
    Option(RType)
    Future(RType?)
    Stream(RType?)
    Result(ok~ : RType?, err~ : RType?)
    Tuple(Array[RType])
    Flags(Array[String])
    Enum(Array[String])
    Alias(RType)
    Resource
    Handle(RHandleKind)
    } derive(Eq,
    Debug
    )

    impl Show for RTypeKind

    RTypeKind::equal

    fn RTypeKind::equal(RTypeKind, RTypeKind) -> Bool

    RTypeKind::not_equal

    fn RTypeKind::not_equal(x : RTypeKind, y : RTypeKind) -> Bool

    RTypeKind::output

    fn RTypeKind::output(self : RTypeKind, logger : &Logger) -> Unit

    RTypeKind::to_json

    RTypeKind::to_string

    fn RTypeKind::to_string(self : RTypeKind) -> String

    RTypeOwner

    pub enum RTypeOwner {
    Interface(Int)
    World(Int)
    None
    } derive(Eq,
    Debug
    )

    impl Show for RTypeOwner

    RTypeOwner::equal

    fn RTypeOwner::equal(RTypeOwner, RTypeOwner) -> Bool

    RTypeOwner::not_equal

    fn RTypeOwner::not_equal(x : RTypeOwner, y : RTypeOwner) -> Bool

    RTypeOwner::output

    fn RTypeOwner::output(self : RTypeOwner, logger : &Logger) -> Unit

    RTypeOwner::to_json

    RTypeOwner::to_string

    fn RTypeOwner::to_string(self : RTypeOwner) -> String

    RVariantCase

    pub struct RVariantCase {
    name : String
    case_type : RType?
    } derive(Eq,
    Debug
    )

    RVariantCase::equal

    RVariantCase::not_equal

    fn RVariantCase::not_equal(x : RVariantCase, y : RVariantCase) -> Bool

    RVariantCase::output

    fn RVariantCase::output(self : RVariantCase, logger : &Logger) -> Unit

    RVariantCase::to_json

    RVariantCase::to_string

    fn RVariantCase::to_string(self : RVariantCase) -> String

    RWorld

    pub struct RWorld {
    name : String
    docs : String?
    imports : Map[String, RWorldItem]
    exports : Map[String, RWorldItem]
    pkg : Int?
    } derive(Eq,
    Debug
    )

    impl Show for RWorld

    RWorld::equal

    fn RWorld::equal(RWorld, RWorld) -> Bool

    RWorld::not_equal

    fn RWorld::not_equal(x : RWorld, y : RWorld) -> Bool

    RWorld::output

    fn RWorld::output(self : RWorld, logger : &Logger) -> Unit

    RWorld::to_json

    RWorld::to_repr

    RWorld::to_string

    fn RWorld::to_string(self : RWorld) -> String

    RWorldItem

    pub enum RWorldItem {
    Interface(RInterfaceRef)
    Function(RFunction)
    Type(Int)
    } derive(Eq,
    Debug
    )

    World item
    impl Show for RWorldItem

    RWorldItem::equal

    fn RWorldItem::equal(RWorldItem, RWorldItem) -> Bool

    RWorldItem::not_equal

    fn RWorldItem::not_equal(x : RWorldItem, y : RWorldItem) -> Bool

    RWorldItem::output

    fn RWorldItem::output(self : RWorldItem, logger : &Logger) -> Unit

    RWorldItem::to_json

    RWorldItem::to_string

    fn RWorldItem::to_string(self : RWorldItem) -> String

    Resolve

    pub struct Resolve {
    worlds : Array[RWorld]
    interfaces : Array[RInterface]
    types : Array[RTypeDef]
    packages : Array[RPackage]
    } derive(Eq,
    Debug
    )

    impl Show for Resolve

    Resolve::equal

    fn Resolve::equal(Resolve, Resolve) -> Bool

    Resolve::not_equal

    fn Resolve::not_equal(x : Resolve, y : Resolve) -> Bool

    Resolve::output

    fn Resolve::output(self : Resolve, logger : &Logger) -> Unit

    Resolve::to_json

    Resolve::to_repr

    Resolve::to_string

    fn Resolve::to_string(self : Resolve) -> String

    ResolveInput

    pub struct ResolveInput {
    resolve : Resolve
    world_id : Int
    } derive(Eq,
    Debug
    )

    ResolveInput::equal

    ResolveInput::not_equal

    fn ResolveInput::not_equal(x : ResolveInput, y : ResolveInput) -> Bool

    ResolveInput::output

    fn ResolveInput::output(self : ResolveInput, logger : &Logger) -> Unit

    ResolveInput::to_json

    ResolveInput::to_string

    fn ResolveInput::to_string(self : ResolveInput) -> String

    ResolvedInterfaceInfo

    pub struct ResolvedInterfaceInfo {
    interface_id : Int
    name : String?
    docs : String?
    package_name : RPackageName?
    functions : Map[String, RFunction]
    types : Map[String, ResolvedTypeInfo]
    } derive(Eq,
    Debug
    )

    ResolvedInterfaceInfo::equal

    ResolvedInterfaceInfo::not_equal

    ResolvedInterfaceInfo::output

    fn ResolvedInterfaceInfo::output(self : ResolvedInterfaceInfo, logger : &Logger) -> Unit

    ResolvedInterfaceInfo::to_string

    fn ResolvedInterfaceInfo::to_string(self : ResolvedInterfaceInfo) -> String

    ResolvedTypeInfo

    pub struct ResolvedTypeInfo {
    local_name : String
    type_id : Int
    type_name : String?
    type_kind : RTypeKind
    owner : RTypeOwner
    owner_package : RPackageName?
    owner_interface : String?
    owner_world : String?
    } derive(Eq,
    Debug
    )

    ResolvedTypeInfo::equal

    ResolvedTypeInfo::not_equal

    fn ResolvedTypeInfo::not_equal(x : ResolvedTypeInfo, y : ResolvedTypeInfo) -> Bool

    ResolvedTypeInfo::output

    fn ResolvedTypeInfo::output(self : ResolvedTypeInfo, logger : &Logger) -> Unit

    ResolvedTypeInfo::to_string

    fn ResolvedTypeInfo::to_string(self : ResolvedTypeInfo) -> String

    Resource

    pub struct Resource {
    funcs : Array[Function]
    } derive(Eq,
    Debug
    )

    impl Show for Resource

    Resource::equal

    fn Resource::equal(Resource, Resource) -> Bool

    Resource::not_equal

    fn Resource::not_equal(x : Resource, y : Resource) -> Bool

    Resource::output

    fn Resource::output(self : Resource, logger : &Logger) -> Unit

    Resource::to_repr

    Resource::to_string

    fn Resource::to_string(self : Resource) -> String

    Token

    pub struct Token {
    token_type : TokenType
    offset : Int
    } derive(Eq,
    Debug
    )

    impl Show for Token

    Token::equal

    fn Token::equal(Token, Token) -> Bool

    Token::not_equal

    fn Token::not_equal(x : Token, y : Token) -> Bool

    Token::output

    fn Token::output(self : Token, logger : &Logger) -> Unit

    Token::to_repr

    Token::to_string

    fn Token::to_string(self : Token) -> String

    TokenType

    pub enum TokenType {
    Ident(String)
    Keyword(String)
    Symbol(String)
    StringLit(String)
    Number(String)
    Doc(String)
    Eof
    } derive(Eq,
    Debug
    )

    impl Show for TokenType

    TokenType::equal

    fn TokenType::equal(TokenType, TokenType) -> Bool

    TokenType::not_equal

    fn TokenType::not_equal(x : TokenType, y : TokenType) -> Bool

    TokenType::output

    fn TokenType::output(self : TokenType, logger : &Logger) -> Unit

    TokenType::to_string

    fn TokenType::to_string(self : TokenType) -> String

    TypeDef

    pub struct TypeDef {
    name : String
    kind : TypeDefKind
    docs : String?
    external_id : String?
    } derive(Eq,
    Debug
    )

    impl Show for TypeDef

    TypeDef::equal

    fn TypeDef::equal(TypeDef, TypeDef) -> Bool

    TypeDef::not_equal

    fn TypeDef::not_equal(x : TypeDef, y : TypeDef) -> Bool

    TypeDef::output

    fn TypeDef::output(self : TypeDef, logger : &Logger) -> Unit

    TypeDef::to_repr

    TypeDef::to_string

    fn TypeDef::to_string(self : TypeDef) -> String

    TypeDefKind

    pub enum TypeDefKind {
    Record(Array[Field])
    Enum(Array[String])
    Flags(Array[String])
    Variant(Array[VariantCase])
    Alias(TypeExpr)
    Resource(Resource)
    } derive(Eq,
    Debug
    )

    impl Show for TypeDefKind

    TypeDefKind::equal

    fn TypeDefKind::equal(TypeDefKind, TypeDefKind) -> Bool

    TypeDefKind::not_equal

    fn TypeDefKind::not_equal(x : TypeDefKind, y : TypeDefKind) -> Bool

    TypeDefKind::output

    fn TypeDefKind::output(self : TypeDefKind, logger : &Logger) -> Unit

    TypeDefKind::to_string

    fn TypeDefKind::to_string(self : TypeDefKind) -> String

    TypeExpr

    pub enum TypeExpr {
    Bool
    U8
    U16
    U32
    U64
    S8
    S16
    S32
    S64
    F32
    F64
    Char
    String_
    ErrorContext
    Id(String)
    List(TypeExpr)
    FixedLengthList(TypeExpr, UInt)
    Map(TypeExpr, TypeExpr)
    Option(TypeExpr)
    Future(TypeExpr?)
    Stream(TypeExpr?)
    Result(TypeExpr?, TypeExpr?)
    Tuple(Array[TypeExpr])
    Own(String)
    Borrow(String)
    } derive(Eq,
    Debug
    )

    impl Show for TypeExpr

    TypeExpr::equal

    fn TypeExpr::equal(TypeExpr, TypeExpr) -> Bool

    TypeExpr::not_equal

    fn TypeExpr::not_equal(x : TypeExpr, y : TypeExpr) -> Bool

    TypeExpr::output

    fn TypeExpr::output(self : TypeExpr, logger : &Logger) -> Unit

    TypeExpr::to_repr

    TypeExpr::to_string

    fn TypeExpr::to_string(self : TypeExpr) -> String

    UseDecl

    pub struct UseDecl {
    from : UsePath
    names : Array[String]
    renames : Array[IncludeRename]
    } derive(Eq,
    Debug
    )

    impl Show for UseDecl

    UseDecl::equal

    fn UseDecl::equal(UseDecl, UseDecl) -> Bool

    UseDecl::not_equal

    fn UseDecl::not_equal(x : UseDecl, y : UseDecl) -> Bool

    UseDecl::output

    fn UseDecl::output(self : UseDecl, logger : &Logger) -> Unit

    UseDecl::to_repr

    UseDecl::to_string

    fn UseDecl::to_string(self : UseDecl) -> String

    UsePath

    pub struct UsePath {
    pkg : PackageName?
    interface : String
    } derive(Eq,
    Debug
    )

    impl Show for UsePath

    UsePath::equal

    fn UsePath::equal(UsePath, UsePath) -> Bool

    UsePath::not_equal

    fn UsePath::not_equal(x : UsePath, y : UsePath) -> Bool

    UsePath::output

    fn UsePath::output(self : UsePath, logger : &Logger) -> Unit

    UsePath::to_repr

    UsePath::to_string

    fn UsePath::to_string(self : UsePath) -> String

    VariantCase

    pub struct VariantCase {
    name : String
    ty : TypeExpr?
    } derive(Eq,
    Debug
    )

    impl Show for VariantCase

    VariantCase::equal

    fn VariantCase::equal(VariantCase, VariantCase) -> Bool

    VariantCase::not_equal

    fn VariantCase::not_equal(x : VariantCase, y : VariantCase) -> Bool

    VariantCase::output

    fn VariantCase::output(self : VariantCase, logger : &Logger) -> Unit

    VariantCase::to_string

    fn VariantCase::to_string(self : VariantCase) -> String

    WitFile

    pub struct WitFile {
    pkg : PackageName?
    interfaces : Array[Interface]
    worlds : Array[World]
    packages : Array[WitFile]
    } derive(Eq,
    Debug
    )

    impl Show for WitFile

    WitFile::equal

    fn WitFile::equal(WitFile, WitFile) -> Bool

    WitFile::not_equal

    fn WitFile::not_equal(x : WitFile, y : WitFile) -> Bool

    WitFile::output

    fn WitFile::output(self : WitFile, logger : &Logger) -> Unit

    WitFile::to_repr

    WitFile::to_string

    fn WitFile::to_string(self : WitFile) -> String

    World

    pub struct World {
    name : String
    docs : String?
    types : Array[TypeDef]
    imports : Array[WorldItem]
    exports : Array[WorldItem]
    } derive(Eq,
    Debug
    )

    impl Show for World

    World::equal

    fn World::equal(World, World) -> Bool

    World::not_equal

    fn World::not_equal(x : World, y : World) -> Bool

    World::output

    fn World::output(self : World, logger : &Logger) -> Unit

    World::to_repr

    World::to_string

    fn World::to_string(self : World) -> String

    WorldItem

    pub enum WorldItem {
    Interface(UsePath)
    NamedInterface(String, UsePath)
    External(String, WorldItem)
    Function(Function)
    InlineInterface(InlineInterface)
    Include(IncludeDecl)
    Use(UseDecl)
    } derive(Eq,
    Debug
    )

    impl Show for WorldItem

    WorldItem::equal

    fn WorldItem::equal(WorldItem, WorldItem) -> Bool

    WorldItem::not_equal

    fn WorldItem::not_equal(x : WorldItem, y : WorldItem) -> Bool

    WorldItem::output

    fn WorldItem::output(self : WorldItem, logger : &Logger) -> Unit

    WorldItem::to_string

    fn WorldItem::to_string(self : WorldItem) -> String

    interface_infos

    fn interface_infos(resolve : Resolve) -> Array[ResolvedInterfaceInfo]

    Build resolved interface infos from Resolve.

    parse

    fn parse(source : String) -> Result[WitFile, ParseError]

    Parse a WIT source string into a WitFile.

    parse_path

    fn parse_path(path : String) -> Result[WitFile, ParseError]

    Parse a WIT file or directory into a WitFile.

    resolve

    fn resolve(source : String) -> Result[Resolve, ParseError]

    Resolve a WIT source string into a Resolve.

    resolve_interface_infos

    fn resolve_interface_infos(source : String) -> Result[Array[ResolvedInterfaceInfo], ParseError]

    Resolve WIT source and return resolved interface infos.

    resolve_multi

    fn resolve_multi(asts : Array[WitFile]) -> Result[Resolve, ParseError]

    Resolve multiple WIT ASTs into a single Resolve.

    resolve_path

    fn resolve_path(path : String, world? : String) -> Result[ResolveInput, ParseError]

    Resolve a WIT file or directory (with deps) into a ResolveInput.

    resolve_path_interface_infos

    fn resolve_path_interface_infos(path : String, world? : String) -> Result[Array[ResolvedInterfaceInfo], ParseError]

    Resolve WIT path and return resolved interface infos.

    tokenize

    fn tokenize(source : String) -> Result[Array[Token], ParseError]