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 doc;
20pub mod forms;
21pub mod kigou;
22pub mod lex;
23pub mod parse;
24pub mod scope;
25pub mod spelling;
26pub mod yakugo;
27
28pub use forms::{Form, FORMS};
29pub use lex::{lex, LexError, Span, Token, TokenKind};
30// Re-exported so a consumer walking blue trees does not have to depend on
31// tatara-lisp directly just to name the node types blue emits.
32pub use parse::{
33 comments, is_callable_name, is_reserved_word, keyword_doc, parse_expr, parse_program,
34 parse_program_documented, parse_program_documented_with_depth, parse_program_in,
35 parse_program_spanned, parse_program_spanned_with_depth, parse_program_tree,
36 parse_program_tree_in, parse_program_tree_with_depth, parse_program_with_depth,
37 parses_on_this_thread, qualified, qualify, spelling_notes, Comment, Infix, ParseError,
38 BLOCK_KEYWORDS, BUILTIN_QUALIFIER, INFIX, LOWERED_ASSERT, LOWERED_ATTEMPTED, LOWERED_CONCAT,
39 LOWERED_ENSURE, LOWERED_ERROR_MATCH, LOWERED_FAILED, LOWERED_FIELD, LOWERED_HEADS,
40 LOWERED_KWARGS, LOWERED_MAP, LOWERED_MERGE, LOWERED_OPTIONAL_ARG, LOWERED_OPTIONAL_ARITY,
41 LOWERED_RERAISE, LOWERED_SPLICE, MASTER_VERBS, MAX_EXPR_DEPTH, OPERATOR_KEYWORDS,
42 OPTIONAL_MARKER, QUALIFIER, RESCUED, SURFACE_KEYWORDS, SYMBOL_SPELLINGS,
43};
44pub use spelling::{Note, Spelling};
45// `Spanned`/`SpannedForm` alongside `Sexp` for the same reason `Sexp` is here:
46// the parser's real output is the spanned tree, and a consumer that wants a
47// position should not have to add a tatara-lisp dependency to name the node it
48// got a span from.
49pub use tatara_lisp::{Atom, Sexp, Spanned, SpannedForm};