Skip to main content

microcad_syntax/
lib.rs

1// Copyright © 2026 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4//! Syntax definitions and parser for µcad source code.
5//!
6//! This module includes the components to parse µcad source code into a stream of tokens or abstract syntax tree.
7//!
8//! - Transform source code into a stream of tokens with [`lex`]
9//! - Create an abstract syntax tree from the list of tokens with [`parse`]
10
11use std::ops::Range;
12
13/// Span for tokens or AST nodes, a range of byte offsets from the start of the source
14pub type Span = Range<usize>;
15
16/// Abstract syntax tree for µcad files
17pub mod ast;
18mod parser;
19/// Source tokens for µcad files
20pub mod tokens;
21
22pub use tokens::lex;
23pub use parser::{parse, ParseError};