Skip to content

isidentical/pyasdl

Repository files navigation

PyASDL

A pure Python implementation of the Zephyr ASDL format.

API

parse(source, *, filename = ...) -> Module

Parse the given source string, and return the AST in the shape of an pyasdl.Module. The full format is defined in the grammar.asdl file. The filename can be optionally supplied, and will be used if any syntax errors found during the parsing process.

fetch_comments(source) -> Iterator[str]

Iterate over all the comments (in the shape of -- comment) in the given ASDL source string.

is_simple_sum(node) -> bool

Check whether if the given node is an enum (or simple sum) (e.g. a sum where none of the members has constructor fields).

Examples

Here is a list of example tools that process the given ASDL with PyASDL: