#semantic #php #ast #analysis #check #rules #issue

mago-semantics

Performs semantic analysis on PHP code, interpreting the AST to check correctness, resolve references, and enforce language rules

8 releases

new 0.0.7 Dec 10, 2024
0.0.6 Dec 10, 2024

#243 in Programming languages

Download history 368/week @ 2024-12-04

368 downloads per month
Used in 7 crates (5 directly)

MIT/Apache

1MB
20K SLoC

Mago Semantics Crate

The mago_semantics crate provides semantic analysis capabilities for PHP code. Mago is the name of the toolchain, and this crate processes PHP source code to generate an abstract syntax tree (AST), performs name resolution, builds a symbol table, and detects semantic issues.

This crate is essential for the compilation pipeline of PHP within the Mago toolchain, ensuring that source code adheres to the language's semantic rules before code generation or interpretation.

Features

  • Parsing: Converts PHP source code into an AST.
  • Name Resolution: Associates identifiers with their declarations.
  • Symbol Table Construction: Records all symbols (classes, functions, variables) for quick lookup.
  • Semantic Analysis: Checks for semantic correctness and reports issues.

Dependencies

~13–23MB
~305K SLoC