MayaMelParser is a Rust workspace for parsing and analyzing Autodesk Maya MEL.
The main library is maya-mel, an
experimental 0.x crate for typed parsing, diagnostics, semantic analysis, and
Maya-oriented top-level command facts.
Use it when you need to inspect MEL source, build diagnostics, or extract structured facts from Maya scripts. Do not treat it as a formatter, interpreter, or full Maya runtime integration.
- typed MEL parsing for core statement and expression surfaces
- source spans, decode diagnostics, lex/parse diagnostics, and semantic diagnostics
- semantic analysis for proc visibility, name resolution, and command normalization
- Maya-oriented top-level fact collection backed by command metadata
- lightweight parse/scan surfaces for inspection-oriented or large-input workflows
mel-inspect, a local CLI for single-file inspection and corpus summaries
Add the library:
cargo add maya-melParse source and run generic semantic analysis:
use maya_mel::{analyze, parse_source};
let parsed = parse_source("global proc hello() { print(\"hi\"); }");
let analysis = analyze(&parsed.syntax, parsed.source_view());
assert!(parsed.errors.is_empty());
assert!(analysis.diagnostics.is_empty());Collect Maya-oriented facts when builtin command metadata matters:
use maya_mel::{
MayaCommandRegistry, collect_top_level_facts_with_registry, parse_source,
};
let parsed = parse_source("createNode transform -n \"root\";");
let facts =
collect_top_level_facts_with_registry(&parsed, &MayaCommandRegistry::new());
assert_eq!(facts.items.len(), 1);Common entry points:
parse_source/parse_filefor full typed parsinganalyze/analyze_with_registryfor semantic diagnosticscollect_top_level_facts/collect_top_level_facts_with_registryfor Maya-oriented extractionmaya_mel::parser::parse_light_*andscan_light_*for lightweight workflows
Install the local inspection CLI from this repository:
cargo install --path crates/mel-cliCurrent CLI surface:
mel-inspect [OPTIONS] [PATH]
--encoding <auto|utf8|cp932|gbk>
--diagnostic-level <all|error|none>
--max-bytes <MAX_BYTES>
--lightweight
--inline <SOURCE>
Inspect one file:
mel-inspect examples/basic.melInspect with the lightweight path:
mel-inspect --lightweight examples/basic.melPass inline source:
mel-inspect --inline 'createNode transform -n "root";'If PATH is a directory, mel-inspect prints a corpus-style summary across
the discovered MEL files.
Example diagnostic output:
- coverage is useful today, but still incomplete for the full MEL language surface
- parser recovery and semantic coverage are still expanding
- Maya-specific specialization is selective rather than exhaustive
- this repository is not targeting formatting, interpretation, or direct Maya runtime integration
The current pipeline is AST-first and keeps parsing separate from semantic resolution:
source
-> syntax
-> lexer
-> ast
-> parser
-> sema
-> maya
-> mel-cli
Important design choices:
- parser output preserves invocation surface instead of resolving commands too early
- command, proc, and plugin-command resolution belong to semantic analysis
- spans are carried through syntax and diagnostics
- a lightweight path exists alongside the full parse surface for large inputs
Design details live in .agents/docs/architecture.md.
crates/maya-mel: public library cratecrates/mel-cli: local inspection CLItests/corpus: public MEL fixturesexamples: sample MEL sources
See CHANGELOG.md for release notes.
