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.5.6.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

cedarscript_ast_parser-0.5.6-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.5.6.tar.gz
Algorithm Hash digest
SHA256 f948802abb95208c5e08b6d747e874f993af7bd29003294b9c2b61c94f43b71b
MD5 3634279f1b1f43de298d47d3820443eb
BLAKE2b-256 a48f739318428beb85b2daf4995e56365057d33fcc8639821a5876d0e7d198c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb377fe6795364269b9d733f385526ab9c1b10f52e323806a974fc0c9e1c7ea
MD5 883d809595c5efa45086a08943613f05
BLAKE2b-256 1b3ed91a6e5b12f52d0bf2719dd0e71cfc89b83b6c9dc732ceaf8912fc03dc4d

See more details on using hashes here.

Supported by

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