35 releases

Uses new Rust 2024

0.2.26 Aug 18, 2025
0.2.25 Aug 16, 2025
0.2.19 Jul 30, 2025
0.1.16 Apr 7, 2025
0.0.14 Apr 1, 2025

#13 in #semantic-analysis

Download history 963/week @ 2025-07-02 840/week @ 2025-07-09 583/week @ 2025-07-16 586/week @ 2025-07-23 567/week @ 2025-07-30 310/week @ 2025-08-06 383/week @ 2025-08-13 89/week @ 2025-08-20 56/week @ 2025-08-27 57/week @ 2025-09-03 54/week @ 2025-09-10 45/week @ 2025-09-17 34/week @ 2025-09-24 60/week @ 2025-10-01 22/week @ 2025-10-08

177 downloads per month
Used in 11 crates (4 directly)

MIT license

540KB
12K SLoC

Swamp Analyzer

Performs semantic analysis for the Swamp programming language.

Overview

This crate bridges the gap between parsing and code generation/interpretation. It takes the Abstract Syntax Tree (AST) generated by swamp-parser (using types from swamp-ast) and transforms it into a type-checked, resolved Abstract Semantic Graph (ASG) defined in swamp-semantic.

The core process involves:

  • Type Checking: Verifying that operations, assignments, function calls, etc., adhere to the Swamp type system rules.
  • Name Resolution: Linking identifiers (variables, functions, types) to their definitions within the correct scope.
  • Semantic Validation: Performing other checks like correct function arity, operator usage, and pattern matching exhaustiveness (potentially).
  • ASG Construction: Building the swamp_semantic::Expression tree, which represents the program with full type information and resolved references.

License

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

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

Dependencies

~680KB
~13K SLoC