Skip to main content

A library for parsing and interpreting CEDARScript, a SQL-like language for code analysis and transformations

Project description

CEDARScript AST Parser

PyPI version Python Versions Code style: black AGPL v3

CEDARScript AST Parser is a Python library for parsing and interpreting CEDARScript, a SQL-like language designed for concise code analysis, manipulation, and refactoring tasks.

What is CEDARScript?

CEDARScript (Concise Examination, Development, And Refactoring Script) is a domain-specific language that aims to improve how AI coding assistants interact with codebases and communicate their code modification intentions. It provides a standardized way to express complex code modification and analysis operations, making it easier for AI-assisted development tools to understand and execute these tasks.

Features

  • Parse CEDARScript Abstract Syntax Tree (AST) that was generated by Tree-Sitter into a list of commands
  • Support for various code manipulation and analysis commands (CREATE, UPDATE, RM, MV, SELECT)
  • Return results in XML format for easier parsing and processing by LLM systems

Installation

You can install CEDARScript Parser using pip:

pip install cedarscript-ast-parser

Usage

Here's a quick example of how to use CEDARScript Parser:

from cedarscript_ast_parser import CEDARScriptASTParser

parser = CEDARScriptASTParser()
code = """
CREATE FILE "example.py"
UPDATE FILE "example.py"
    INSERT AT END OF FILE
        CONTENT
            print("Hello, World!")
        END CONTENT
END UPDATE
"""

commands, errors = parser.parse_script(code)

if errors:
    for error in errors:
        print(f"Error: {error}")
else:
    for command in commands:
        print(f"Parsed command: {command}")

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

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

cedarscript_ast_parser-0.7.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cedarscript_ast_parser-0.7.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file cedarscript_ast_parser-0.7.0.tar.gz.

File metadata

  • Download URL: cedarscript_ast_parser-0.7.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for cedarscript_ast_parser-0.7.0.tar.gz
Algorithm Hash digest
SHA256 faa247376c884d6b7b9bb5d259344b9d5b33077a0a3dcecc4bb2b98cf0d7a837
MD5 24216e3188db00ed5fb2ee46d0f4822a
BLAKE2b-256 e9900e4e0534ab4f5eee7ec2f4f563d58f1f8e9e5caa6bd4cf51c501aa650235

See more details on using hashes here.

File details

Details for the file cedarscript_ast_parser-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 776d0dd67fefa7b120fa59d0b3a68af50835830b92a12e99c9bcc90555fbdd1d
MD5 2bd5cd5023b0c2a0c33eb853c12765b0
BLAKE2b-256 825f3adda74f4837359986a51aa50287aa44e917da3f89dde7aed3b447e22aba

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