Skip to main content

Move language parser and function call graph analyzer

Project description

Move FCG Analyzer

一个用于分析 Move 项目的静态分析工具,支持函数调用图(Function Call Graph)分析,可以提取函数信息、调用关系、参数等。

功能

  • 提取函数签名、参数、返回类型
  • 提取函数源代码和位置信息
  • 准确提取函数调用关系(calls)
  • 支持模块限定的函数查询
  • 输出标准 JSON 格式

构建

1. 安装依赖

npm install

2. 构建 TypeScript Indexer

npm run build:indexer

使用

Python API

from move_fcg_analyzer import MoveFunctionAnalyzer

analyzer = MoveFunctionAnalyzer()
result = analyzer.analyze_raw("./project_path", "function_name")

# result 包含 contract, function, source, location, parameter, calls 等字段
print(result["calls"])  # 查看函数调用关系

命令行

python3 -m move_fcg_analyzer <project_path> <function_name>

示例:

python3 -m move_fcg_analyzer ./test/caas-framework grant_read_authorization

输出格式

{
  "contract": "module_name",
  "function": "function_signature",
  "source": "function_source_code",
  "location": {
    "file": "/path/to/file.move",
    "start_line": 134,
    "end_line": 204
  },
  "parameter": [
    {"name": "param_name", "type": "param_type"}
  ],
  "calls": [
    {
      "file": "/path/to/called/function.move",
      "function": "called_function_name",
      "module": "called_module_name"
    }
  ]
}

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

move_fcg_analyzer-1.0.0.tar.gz (178.8 kB view details)

Uploaded Source

File details

Details for the file move_fcg_analyzer-1.0.0.tar.gz.

File metadata

  • Download URL: move_fcg_analyzer-1.0.0.tar.gz
  • Upload date:
  • Size: 178.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for move_fcg_analyzer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 392f60f46606f8c1c65c3b6fb3e770686da46d39825ddf9f79146d8516971b9e
MD5 8bdbecc3e917d761e709ce7d8e7bdedd
BLAKE2b-256 2d6b0389e69d9f5961a639559485a8f2612e259b6af9456660169220684473ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page