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 kigou;
20pub mod lex;
21pub mod parse;
22pub mod yakugo;
23
24pub use lex::{lex, LexError, Span, Token, TokenKind};
25// Re-exported so a consumer walking blue trees does not have to depend on
26// tatara-lisp directly just to name the node types blue emits.
27pub use parse::{
28 comments, parse_expr, parse_program, parse_program_in, parse_program_spanned,
29 parse_program_spanned_with_depth, parse_program_with_depth, Comment, Infix, ParseError, INFIX,
30 LOWERED_ASSERT, LOWERED_CONCAT, LOWERED_MAP, MAX_EXPR_DEPTH, SURFACE_KEYWORDS,
31};
32pub use tatara_lisp::{Atom, Sexp};