Skip to main content

Crate buildlang

Crate buildlang 

Source
Expand description

§BuildLang Compiler

This crate provides the complete BuildLang compiler implementation including:

  • Lexical analysis (tokenization)
  • Parsing (recursive descent with Pratt parsing for expressions)
  • Type checking (Hindley-Milner with extensions)
  • Code generation (LLVM IR, WASM, SPIR-V)

§Example

ⓘ
use buildlang::{compile, CompileOptions, Target};

let source = r#"
    fn main() {
        println("Hello, BuildLang!")
    }
"#;

let output = compile(source, Target::Native, CompileOptions::default())?;

Re-exports§

pub use codegen::CodeGenerator;
pub use codegen::GeneratedCode;
pub use codegen::OutputFormat;
pub use codegen::Target;
pub use fmt::FormatConfig;
pub use fmt::FormatError;
pub use fmt::Formatter;
pub use lexer::Lexer;
pub use lexer::SourceFile;
pub use lexer::Span;
pub use lexer::Token;
pub use lexer::TokenKind;
pub use lsp::run_server;
pub use lsp::DocumentStore;
pub use lsp::LanguageServer;
pub use pkg::Lockfile;
pub use pkg::Manifest;
pub use pkg::Registry;
pub use pkg::Resolver;
pub use pkg::Version;
pub use pkg::VersionReq;
pub use runtime::Channel;
pub use runtime::Executor;
pub use runtime::Future;
pub use runtime::Poll;
pub use runtime::Semaphore;
pub use runtime::Task;
pub use runtime::TaskId;

Modules§

ast
Abstract Syntax Tree
bdf
Build Data Format (BDF) v0 - the native, effect-typed interchange format.
bql
BuildDB tables for a compiled program, and BuildQL over them.
codegen
Code Generation
diagnostics
Structured diagnostics: one shape for lexer, parser, checker and backend errors, rendered as JSON by buildc check --error-format=json.
fmt
Code formatter for BuildLang.
lexer
Lexical Analysis
lsp
Language Server Protocol implementation for BuildLang.
macro_expand
Macro Expansion
parser
Parser
pkg
Package manager for BuildLang (build-pkg).
runtime
Runtime support for BuildLang programs.
serde_float
Lossless f64 serde: store the raw IEEE-754 bit pattern as a u64.
tv
Translation validation for the C backend.
types
Type System
units
Compile-time dimensional analysis: first-class typed physical units.
verify
buildc verify: laws and contracts, checked by the compiler.

Constants§

AUTHOR
Author information
COPYRIGHT
Copyright notice
LANGUAGE_VERSION
The language version
VERSION
The compiler version