Skip to main content

Crate blue_lang_syntax

Crate blue_lang_syntax 

Source
Expand description

blue’s surface syntax.

Blue is a general-purpose language whose surface is Ruby/Elixir-shaped and whose program is a tatara-lisp value. This crate is the join: it lexes blue source and parses it directly into tatara_lisp::Sexp.

There is deliberately no private blue AST in between. Tenet 1 of theory/BLUE.md is that blue source parses to tatara-lisp, and an intermediate tree would make homoiconicity a conversion step rather than an identity — the difference between blue’s macro story working and merely being asserted.

use blue_lang_syntax::parse_expr;
let form = parse_expr("user.greet(1)").unwrap();
assert_eq!(form.to_string(), "(greet user 1)");

Re-exports§

pub use lex::lex;
pub use lex::LexError;
pub use lex::Span;
pub use lex::Token;
pub use lex::TokenKind;
pub use parse::comments;
pub use parse::parse_expr;
pub use parse::parse_program;
pub use parse::parse_program_spanned;
pub use parse::Comment;
pub use parse::Infix;
pub use parse::ParseError;
pub use parse::INFIX;
pub use parse::LOWERED_ASSERT;
pub use parse::LOWERED_CONCAT;
pub use parse::LOWERED_MAP;
pub use parse::SURFACE_KEYWORDS;

Modules§

lex
The blue lexer.
parse
Precedence-climbing parser, lowering straight to the tatara-lisp quoted form.

Enums§

Atom
Sexp