webidl

A Web IDL parser for MoonBit

webidl
parser
web
moon add Areo-Joe/webidl@0.2.0
Download zip
Author
Version
0.2.0
License
MIT
Last updated
22 days ago
Downloads
5

Dependencies

README

#webidl

A Web IDL parser for MoonBit.

The parser follows the Web IDL grammar and produces a typed syntax tree rooted at Definitions.

#Installation

Add the package to your MoonBit project:

moon add Areo-Joe/webidl

Then import the root package in moon.pkg:

import {
"Areo-Joe/webidl",
}

#Usage

///|
test "parse Web IDL" {
let definitions = @webidl.parse(
(
#|[Exposed=Window]
#|interface Example {
#| readonly attribute DOMString name;
#|};
),
)
ignore(definitions)
}

parse consumes the complete input and raises when the input is invalid or contains trailing tokens.

Lower-level lexer and grammar-production APIs are available in the lexer and parser packages.

#Validation

The test suite includes the Web IDL files published by the Web Platform Tests project.

Run the tests with:

moon test

#License

MIT

#
parse

fn parse(source : StringView) ->
Definitions
raise

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io