Crate beck_syntax

Crate beck_syntax 

Source
Expand description

The Beck front end: two surfaces, one AST.

   surface/py.beck ──┐                                        ┌── printer.py    ──▶ .beck
                     ├──▶  Reader  ──▶  Node (canonical AST) ─┤
 surface/sx.beck  ───┘        ▲                               └── printer.sexpr ──▶ .sx
                              │
                    both readers produce identical Node trees

(docs/02-syntax.md §2.2.) The equivalence in that last line is not a slogan here: print::tests::the_two_surfaces_are_the_same_language reads the same definition through both readers and asserts the trees are structurally equal.

Re-exports§

pub use node::sym;
pub use node::Head;
pub use node::Lit;
pub use node::Meta;
pub use node::Node;
pub use node::Scope;
pub use node::ScopeSet;
pub use node::Symbol;

Modules§

doc
Doc comments: ## in the Python surface, ;; in the S-expression one.
lexer
Tokens, and the layout algorithm that turns indentation into INDENT/DEDENT.
node
Node — the canonical AST, and an ordinary value.
parser
The Python surface: recursive descent for statements, Pratt for expressions.
print
The printer — one Node tree, two surfaces.
security
What a source file may contain, before anything tries to read it.
sexpr
The S-expression reader — the canonical surface.

Functions§

module_ident
Read a source file in whichever surface its extension names.
parse_file