Skip to main content

blue_lang_syntax/
lib.rs

1//! blue's surface syntax.
2//!
3//! Blue is a general-purpose language whose surface is Ruby/Elixir-shaped
4//! and whose **program is a tatara-lisp value**. This crate is the join:
5//! it lexes blue source and parses it directly into `tatara_lisp::Sexp`.
6//!
7//! There is deliberately no private blue AST in between. Tenet 1 of
8//! `theory/BLUE.md` is that blue source parses *to tatara-lisp*, and an
9//! intermediate tree would make homoiconicity a conversion step rather
10//! than an identity — the difference between blue's macro story working
11//! and merely being asserted.
12//!
13//! ```
14//! use blue_lang_syntax::parse_expr;
15//! let form = parse_expr("user.greet(1)").unwrap();
16//! assert_eq!(form.to_string(), "(greet user 1)");
17//! ```
18
19pub mod lex;
20pub mod parse;
21
22pub use lex::{lex, LexError, Span, Token, TokenKind};
23// Re-exported so a consumer walking blue trees does not have to depend on
24// tatara-lisp directly just to name the node types blue emits.
25pub use tatara_lisp::{Atom, Sexp};
26pub use parse::{
27    comments, parse_expr, parse_program, parse_program_spanned, Comment, Infix, ParseError, INFIX,
28    LOWERED_ASSERT, LOWERED_CONCAT, LOWERED_MAP, SURFACE_KEYWORDS,
29};