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 License: MIT

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

Uploaded Source

Built Distribution

cedarscript_ast_parser-0.3.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7ae4cb2ffbf9e1dcd005c9f26bd3b17dafae7445064569cb1843a87c9386f3dd
MD5 cdd306c83c48c1e8bc22912fe171f2fb
BLAKE2b-256 044faf7cabd284a428862ed3e66d83710e50be50aef599c379249b8c9b5a6879

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87e276593b66999aaae774894f899c4fc36a2b5d60ae9c30a30cea07ae7d1fd1
MD5 9e094baef1d10d61b7dfd379b52ae03e
BLAKE2b-256 e7dea1d56cb0cbb0e4efa4ba39b9b76107da16bac5733f9d0fc1e81cb1759ce4

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