swamp-core

Crates.ioswamp-core
lib.rsswamp-core
version0.2.26
created_at2025-03-29 15:52:38.946928+00
updated_at2025-08-18 11:24:00.899089+00
descriptionInitializes the Swamp core library module, defining primitive type aliases and registering intrinsic functions.
homepage
repositoryhttps://github.com/swamp/swamp
max_upload_size
id1611413
size51,767
Peter Bjorklund (piot)

documentation

README

Swamp Core

Initializes the foundational "core" module for the Swamp programming language.

Overview

This crate is responsible for creating the initial swamp_modules::Module that represents the built-in core library available to all Swamp programs. It populates this module's symbol table with essential definitions required by the language and runtime.

Key Functions

  • Primitive Type Aliases: Defines standard aliases like Int, Float, String, and Bool that map to the underlying primitive types (swamp_types::Type).
  • Intrinsic Function Registration: Registers numerous intrinsic functions. These are functions whose implementation is provided directly by the Swamp runtime/VM (often in Rust, e.g., in swamp-core-extra) rather than being written in Swamp code. This includes functions for:
    • Integer and Float arithmetic/operations (Int.abs, Float.sqrt, etc.)
    • String manipulation (String.len, etc.)
    • Collection operations (Vec.push, Map.get, Grid.set, etc.)
  • Type Generator Registration: Registers built-in type generators like Slice and SlicePair.
  • Module Creation: Provides the create_module function which takes a version and returns the fully populated core Module.

Installation

This crate is primarily a dependency for the Swamp compiler or tools that need to bootstrap the core environment.

[dependencies]
swamp-core = "0.2.26"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/swamp

Commit count: 802

cargo fmt