A library for parsing and interpreting CEDARScript, a SQL-like language for code analysis and transformations
Project description
CEDARScript AST Parser
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cedarscript_ast_parser-0.2.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 633f28032940112cbd3c73e9220d3d87e8b1b132bb01364bf95d9b5b438eb8b6 |
|
MD5 | cf4f09212e7930228892bf5f2796f4e7 |
|
BLAKE2b-256 | 72b0dc0a22ed6b490b52733f622cbb9635308f5dc6cca0bdc63ab733040e0231 |
Hashes for cedarscript_ast_parser-0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f9c8cdc8ab3fa1535c0f9b61b19dca8e290a91de36046ad8a745118946322a |
|
MD5 | f5cddf354f53957cf5418952b1d8dcf4 |
|
BLAKE2b-256 | 3580aa41c0638bd7fdfa43f1ec18a8b95d54ea4c2c1d6413e606d0321a6e8b9b |