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

Uploaded Source

Built Distribution

cedarscript_ast_parser-0.4.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.4.1.tar.gz
Algorithm Hash digest
SHA256 df0a9c11a386602f79bbf0b2d1ca54b8f9fa272521701fa58cafb9c1d0a095f2
MD5 cd3475672161d8203127ee9884c8fce2
BLAKE2b-256 e86850939959f820ed671bc90a8e8d7fef644bfe41ca85a877727d0bbf15bd64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cedarscript_ast_parser-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 432c06c7c6943d85ebcbff05d8f16c00e5c299d362ed1c2dfd94a050c17b040c
MD5 77fe4f0db57998aff31d3dff3a246038
BLAKE2b-256 52213e80bdeeb9b5aced5555795e5979b384b454b8f7e458d431af1dc711d816

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