Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

cs-compilerscs 编译器

Agent Skill

cs-compilers 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

423

周安装

18

GitHub Stars

4

下载量

148
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cs-compilers(cs 编译器)
来源仓库:https://github.com/alphaonedev/openclaw-graph
仓库路径:skills/cs-compilers
安装命令:
npx skills add https://github.com/alphaonedev/openclaw-graph --skill cs-compilers
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alphaonedev/openclaw-graph --skill cs-compilers

简介

支持词法分析、语法解析(LL/LR/PEG)与 LLVM 代码生成等编译器开发任务。

  • 集成 Tree-sitter 实现实时解析,适用于 IDE 与静态分析工具构建。
  • 可用于源码转换、转译器开发与中间表示优化等场景。
  • 安装需通过 npx 添加指定仓库,建议在编译器相关项目中配合使用。
  • cs-compilers 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

cs-compilers

Purpose

This skill equips the AI to handle compiler-related tasks, including lexing, parsing (LL/LR/PEG), building ASTs, semantic analysis, code generation with LLVM, optimizations, and integration with Tree-sitter for real-time parsing.

When to Use

Use this skill when developing compilers, analyzing source code, debugging parsers, generating optimized machine code, or integrating parsing into tools like IDEs. Apply it for tasks involving code transformation, such as transpiling or static analysis in programming languages.

Key Capabilities

  • Lexing: Tokenize input using regex; e.g., define patterns like r'\b(int|float)\b' for keywords in a lexer.
  • Parsing: Implement LL(1) with recursive descent or LR(1) via tools like yacc; use PEG with libraries like packrat; integrate Tree-sitter for efficient parsing, e.g., load a language grammar with tree_sitter.Language.build('path/to/tree-sitter-javascript.wasm').
  • AST Handling: Build and manipulate ASTs; traverse nodes for analysis, e.g., use Tree-sitter's cursor: cursor = tree.walk(); while cursor.goto_first_child(): process_node(cursor).
  • Semantic Analysis: Perform type checking and scope resolution; e.g., check variable declarations against usage in a symbol table.
  • Code Generation: Generate LLVM IR; use the LLVM C++ API to create modules, e.g., LLVMModuleCreateWithName("MyModule") then add functions.
  • Optimization: Apply passes like constant propagation or dead code elimination; e.g., run LLVM's opt tool with flags like -O3 for aggressive optimization.
  • Tree-sitter Integration: Parse code in real-time; supports languages like C, Python via pre-built grammars.

Usage Patterns

Invoke this skill via OpenClaw CLI for direct commands or SDK for programmatic access. Always specify the action and parameters as JSON. For CLI, use: openclaw invoke cs-compilers --action <action> --params '<JSON string>'. In code, import the SDK and call: from openclaw import Client; client = Client(api_key=os.environ['OPENCLAW_API_KEY']); response = client.invoke('cs-compilers', {'action': 'parse', 'params': {'language': 'c', 'code': 'int main(){}'}}). Structure params as a dictionary with keys like "language" and "code". If using external tools, ensure dependencies (e.g., LLVM) are installed and pathed correctly.

Common Commands/API

  • Parse Code: CLI: openclaw invoke cs-compilers --action parse --params '{"language": "python", "code": "def foo(x): return x+1"}'; returns AST as JSON. API: POST /api/skills/cs-compilers with body {"action": "parse", "params": {"language": "python", "code": "def foo(x): return x+1"}}.
  • Generate LLVM IR: CLI: openclaw invoke cs-compilers --action generate-llvm --params '{"language": "c", "code": "int add(int a, int b) {return a+b;}", "optimize": true}'; uses flags like --optimize for passes. API: POST /api/skills/cs-compilers with body {"action": "generate-llvm", "params": {"language": "c", "code": "int add(int a, int b) {return a+b;}"}}.
  • Lex Input: CLI: openclaw invoke cs-compilers --action lex --params '{"input": "int x = 5;", "patterns": ["\\bint\\b"]}'; outputs tokens array. API: POST /api/skills/cs-compilers with body {"action": "lex", "params": {"input": "int x = 5;", "patterns": ["\bint\b"]}}.
  • Config Format: Use JSON for params, e.g., {"grammar": "path/to/grammar.json", "options": {"debug": true}}. Authentication: Set env var $OPENCLAW_API_KEY for all API calls.

Integration Notes

Integrate by installing OpenClaw SDK via pip install openclaw and importing it in your project. For LLVM, ensure clang is installed and link via llvm-config --cxxflags. Tree-sitter requires compiling grammars; e.g., clone a repo and build with make. Handle dependencies in your environment; e.g., set PATH for LLVM tools. For custom parsers, provide a config JSON like {"parserType": "LR", "grammarRules": [{"rule": "E -> T + E"}]}. Test integrations in a sandbox to verify responses.

Error Handling

Always check the response object for an 'error' key; if present, it contains a code and message. For CLI, parse output JSON: if response['error'], exit with code response['error']['code']. In SDK: try: response = client.invoke(...); except OpenClawError as e: log(e.code, e.message). Common errors: 400 for invalid params (e.g., malformed JSON), 401 for auth issues (check $OPENCLAW_API_KEY), 500 for internal failures like parser crashes. Retry transient errors (e.g., 503) with exponential backoff, and validate inputs before invoking, e.g., ensure 'language' is a supported string like 'c' or 'python'.

Concrete Usage Examples

  1. Parsing a C Function: To parse and extract an AST for a simple C function, run: openclaw invoke cs-compilers --action parse --params '{"language": "c", "code": "int main() {return 0;}"}'. This returns a JSON AST like {"type": "function_definition", "name": "main", "body": [...]}. Use the AST to analyze structure, e.g., count nodes.
  2. Generating Optimized LLVM IR: To generate and optimize LLVM IR from C code, execute: openclaw invoke cs-compilers --action generate-llvm --params '{"language": "c", "code": "int add(int a, int b) {return a + b;}", "optimize": true}'. Output might be: "define i32 @add(i32 %a, i32 %b) {%1 = add i32 %a, %b; ret i32 %1}". Pipe this to LLVM tools for further compilation.

Graph Relationships

  • Related to: programming-languages (shares parsing and AST techniques for language design)
  • Related to: software-engineering (connects via code optimization and integration with build tools)
  • Related to: algorithms (overlaps on efficient parsing algorithms like LL and LR)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.38%
按下载量换算54

Claude

30.01%
按下载量换算44

Cursor

17.05%
按下载量换算25

Gemini CLI

8.46%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills